DEV Community

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

Collapse
 
thermatix profile image
Martin Becker • Edited

That looks like the return value, similar to how it's done in rust, what goes in the function is on the left, what comes out of the function is on the right.

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.