4 ms·
The proposed contracts design is quite different to Java and C++'s generics. Why should they use the same syntax? If you want Java and C++ then they are there
by enneff 8y ago
The proposed contracts design is quite different to Java and C++'s generics. Why should they use the same syntax?
If you want Java and C++ then they are there for you to use. Go is a different language and its differences are not gratuitous. Use it for a while and you'll find out why "i int" works better than "int i" (compare Go's pointer and function type specs to C's).
- stephen 8y ago> Why should they use the same syntax? ... Go is a different language True; I harp on Go primarily due to their IMO idiosyncratic approach: AFAIU they claim to be a "purposefully boring", "good for in-the-large" language. (Which is great, I want/like languages like that.) But then they do cute things like the upper/lower case for private, the "method params can be defined `a, b int` because it saves an `int`", the `:=` assignment vs. a standalone `var`/`val` for "hey this is a new variable", not throwing in a ":" for `i: int`, etc., that are all, IMO, very tangential/distracting from their core mission of being a "boring language". So, if they were purposefully trying to be a wildly different language, sure, that's great, I would care a lot less. But it's that they want to be a boring language, and yet are "off" by just enough, that it admittedly frustrates me more than it should.
- enneff 8y agoThose things aren't being "cute". For example, upper/lower case for exported/unexported is a huge readability benefit. You would be less frustrated if you took the time to understand why these decisions were made, instead of pronouncing them arbitrary. Go's designers were long-time C users (longer than anyone else in the world, in fact); they had every reason to stick with the way things worked in C, but they deliberately chose to make Go different.
- jzoch 8y agouppercase vs lowercase is not a readability benefit. For someone reading the code an explicit 'pub' or other operator is much more readable, as in "I understand the implications of what I am reading". Many people can skim over it without realizing the difference of the var name case.
- infogulch 8y agoI thought it was weird for 2 months. Hasn't bothered me in the 4 years since. Except [de]serialization at first, and then I got over it when I realized it's worth the verbosity just to be able to flexibly rename things internally while the external interface remains stable.
- enneff 8y agoYou don't see "pub" where a name is used, only where it is declared. Once you've been using Go for a little while the benefits become obvious.
- int_19h 8y ago> Go's designers were long-time C users (longer than anyone else in the world, in fact); they had every reason to stick with the way things worked in C, but they deliberately chose to make Go different. Most criticisms of Go don't come from C perspective, though.
- enneff 8y agoThe ones I'm responding to in this thread do, though.