4 ms·
If you are putting Go in the category of languages with a type system that doesn't suck, you probably need to study more languages. Go has a few nice things go
by zak_mc_kracken 13y ago
If you are putting Go in the category of languages with a type system that doesn't suck, you probably need to study more languages.
Go has a few nice things going for it but its type system was clearly designed by people who stopped paying attention to type theory and compiler design in the late 90's.
- yepguy 13y agoGo's type system stays out of the way and adds some useful amount of safety. That's more than I can say of any mainstream language. No reason to tear it down just because it doesn't go further.
- danieldk 13y agoGo's type system stays out of the way ... No reason to tear it down just because it doesn't go further. By that line of reasoning, C is a great language. Better type systems exist to prevent many types of bugs. That Go ignores decades of good PL research is a valid point of critique.
- lazyjones 13y ago> Better type systems exist to prevent many types of bugs. That Go ignores decades of good PL research is a valid point of critique. Instead of beating around the bush, would you care to name a few essential, modern features the type system of Go is missing and which could prevent bugs in everyday programming tasks?
- lclarkmichalek 13y agoG E N E R I C S To be read as if chanted by some cheerleaders to a rather bored crowd at this point.
- tmhedberg 13y agoParametric polymorphism ("generics") and sum types.
- danieldk 13y agomodern features the type system of Go is missing How about starting with old features that it are missing, since Go is literally decades behind PL research? - Parametric polymorphism (plus constraints e.g. in the form of type classes). - Algebraic data types - Pattern matching (with non-exhaustiveness checks). - Enforcing purity via the type system. - No null pointers. No, these are not esoteric Haskell features, but have been around in ML since the 70ies. Also, the claim that Go's designers want to keep the language simple is not a strong argument. A language such as ML is simple. Also, many old(er) imperative languages adopted some of these type system features, such as Ada, C++, Java, and D.
- mseepgood 13y agoYes, most of these things are pretty old. Why can't you accept that there are people out there who do not think that these features are unequivocal good ideas or necessary?
- copergi 13y agoBecause those people seem unable to present an argument to support that stance. At best you get "but simple". All of those things are simple. At worst you get outright nonsense that demonstrates that people like Russ and Rob genuinely do not understand the things they are dismissing.
- yohanatan 13y agoI am pretty sure Rob Pike does not fall into that category. My impression is that he is not all that familiar with these features from the ML-derived family of languages. Do you have a quote from him to the contrary (where he specifically rejects these features)?
- deleted 13y ago[deleted]
- asuffield 13y agoI wouldn't say it's exactly brilliant - but it's just missing all the really cool stuff, rather than being buggy. It does what it's trying to do, and then stops. It's a bit like C in that regard (and unlike C++, Java, and C#, which tried to do something much bigger and didn't get it right). It's also a bit like working with first-order propositional logic - well-founded and with its own unique simplicity, but you can't say everything with it and have alternatives. So yes, I'd say that the type system of Go doesn't suck. It's not very good, and there are so many better things out there (rust, I'm looking at you), but it's a long way from being a disaster.
- deleted 13y ago[deleted]