5 ms·
It's worth noting that some of the Go inconsistencies derive from the language designers desire to make the grammar regular (facilitating extremely efficient an
by rcoh 14y ago
It's worth noting that some of the Go inconsistencies derive from the language designers desire to make the grammar regular (facilitating extremely efficient and simple parsing). In order to do this, you need statements that mean different things to the compiler to look different. This manifests itself in the (I admit, very inconsistent) var x int foo vs. x := 5 declaration. They mean the same thing to you, but different things to the compiler -- to preserve a regular grammar, they have to look different.
It's definitely a little ironic that what is needed to make a regular grammar makes the language more inconsistent.
- Mooby 14y agoSupporting declaring variables with new(), make and local variable assignment isn't mandated by the need to make the grammar regular. It's simply a braindead idea. Go might have significant improvements over C, but they screwed the pooch on this one.
- drivebyacct2 14y agoAnother uninformed comment, I can't freaking believe you created a troll account just to spread your ignorance about Go. The difference between make and new is well covered in documentation and on the mailing list.
- Mooby 14y agoSo, when faced with criticism mentioned in the blog post and referred to in a post, instead of thinking about it you mindlessly insult others and say absolutely nothing about what has been said. Who exactly is the troll here?
- drivebyacct2 14y agoWhat do you want me to say? Everything in the blog article is addressed in the two very short documents that have been mentioned all over here. Do I literally need to link you to the FAQ entry for "make vs new"? Or the docs for initialization? You're the one spreading FUD.
- snogglethorpe 14y agoI 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...
- chimeracoder 14y ago> It's worth noting that some of the Go inconsistencies derive from the language designers desire to make the grammar regular FYI, the grammar is context-free, not regular.