IMO the Go syntax is a vast improvement as it's much simpler and avoids the clockwise/spiral issue: https://appliedgo.com/blog/go-declaration-syntax
IMO the Go syntax is a vast improvement as it's much simpler and avoids the clockwise/spiral issue: https://appliedgo.com/blog/go-declaration-syntax
(I also have no doubt that just like Go fixed C's type declarations, in another 20-30 years, Go's successor will finally fix error handling.)
You can't really encode a tree structure with only linear semantics (without at least something like s-expressions).
The advantage of type after name is that it keeps the traversing order consistently pre-order (node, left, right), instead of either:
- the notoriously ridiculous spiral cdecl: reading stuff right (output), node (func name) and left (input)
- create a new name to describe the function in pre-order: Func<Input, Output>
At that point I find a uniform system (without special-casing arrays and pointers - they are also just types) would be simpler.
or, declare the type separately, like in fortran or haskell (or in fact, pre-C99 c)
I've seen julia types unnecessarily fill a whole terminal for otherwise simple operations before, and I have to say I wasn't too impressed...