Comment by meowface
11 years ago
From the Go FAQ (https://golang.org/doc/faq):
>Generics are convenient but they come at a cost in complexity in the type system and run-time. We haven't yet found a design that gives value proportionate to the complexity, although we continue to think about it.
Not hard as in "can't do it", but hard as in too hard to implement without adding the ever feared "complexity".
For the record, I like Go and its philosophy, but I think, above all other issues with the language, the lack of generics is a huge weakness and will eventually be looked back on as a mistake. Not just for not having them before 1.0, but also for waiting as long as they did for adding them, assuming they ever do add them.
The type system is a concern about the complexity for the users of Go, not for the compiler developers.
How exactly? Ignoring issues of backwards compatibility for the moment, I don't think Java's introduction of generics added a ton of complexity for developers, and I don't see why Go would either. In Java's case it seemed like the complexity was definitely on the compiler side, due to their type erasure approach.
I admit I'm not an expert in programming language design though, so I may be completely wrong about both Java and Go.