DEV Community

Discussion on: This is my dream language. Is it real?

Collapse
 
idanarye profile image
Idan Arye

In Rust the type is on the right in both variables and the return:

   name          type
    | name  type   |
    |  |    |      |
    V  V    V      V
fn foo(x: i32) -> i32

In C, the type is on the left for both the variables and the function (though one can argue that the arguments are also part of the function's type):

type name
 |   | type name
 |   |   |  |
 V   V   V  V
int foo(int x)

In this syntax the order is sometimes type...name and sometimes name...type:

name          type
 | type name   |
 |   |  |      |
 V   V  V      V
foo(Int x) -> Int
Thread Thread
 
thermatix profile image
Martin Becker

AH, yes you're right, I missed what you were specifically talking about.