top | item 10060525

(no title)

general_failure | 10 years ago

I don't code much in Go but the thing that bothers me the most is the way variable types come after the variables names. What is surprising is nobody talk seems to be bothered by this at all....

discuss

order

Retra|10 years ago

That's actually the more 'normal' way of doing it. In type theory (or mathematics in general), you almost always write value: Type. (For instance F: A -> B.)

This is how it is done in ML, Haskell, Erlang, Rust, Smalltalk, etc...

It's mostly just C-like languages that do it the other way.

dpc_pw|10 years ago

As dayjob C coder, I just find the way types are written in C complete nonsense (especially when you start declaring pointers to functions), and no modern language should force that horror upon developers.

Go types syntax is well done, IMO, even though I'm not into Go language that much (I rather Rust).

_ak|10 years ago

The good thing about how things are structured in Go is that you can read your types from left to right, while in C, you need to use a more intricate way of reading types... http://c-faq.com/decl/spiral.anderson.html