3 ms·
I suspect the grammar issues could have been worked out in a more natural and consistent manner. E.g., instead of a special ":=" declare-with-auto-type+assign
by snogglethorpe 14y ago
I suspect the grammar issues could have been worked out in a more natural and consistent manner.
E.g., instead of a special ":=" declare-with-auto-type+assign operator, just use ":" in all type declarations, and make the type optional in initialized declarations. Then the following would all be equivalent:
var x : int; x = 5
var x : int = 5
var x := 5
Using ":" in declarations would also make them more readable, and more consistent with most other languages using this type of declaration syntax. [If you've read my other comments about Go on HN, this is a pet peeve of mine... :]
Go's syntax does feel pretty sloppy, like it evolved under a variety of different authors and directions, and never really got a cleanup pass in the end...