| Check this out:
https://commandcenter.blogspot.com/2012/06/less-is-exponenti... Particularly this: >Early in the rollout of Go I was told by someone that he could not imagine working in a language without generic types. As I have reported elsewhere, I found that an odd remark. >What it says is that he finds writing containers like lists of ints and maps of strings an unbearable burden. I find that an odd claim. I spend very little of my programming time struggling with those issues, even in languages without generic types. >But more important, what it says is that types are the way to lift that burden. Types. Not polymorphic functions or language primitives or helpers of other kinds, but types. >Programmers who come to Go from C++ and Java miss the idea of programming with types, particularly inheritance and subclassing and all that. Perhaps I'm a philistine about types but I've never found that model particularly expressive (He then continues to rant about inheritance, without mentioning generics again.) So basically, Go does not have Generics and one of the creators justified it by conflating subtype polymorphism, parametric polymorphism and ad-hoc polymorphism (inheritance, generics and interfaces in oop terms). I happen to agree with Rob Pike that inheritance is a bad way to model things in most cases, but that's a non-sequitur argument against generics. I also think his arguments about composition is weak, especially compared to how function composition works in Haskell. The Doug McIlroy-quote he pulls out fits great with point-free style haskell, and parametric polymorphism/generics is extremely useful for this. (To be fair, he has since said that it is a weakness that might change: https://blog.golang.org/slices ) |