Disclosure: I've recently been designing a rich type system for representing hierarchical datasets, and I've also worked on a large production system written in Go, so I have some skin in this game.
> Here's a long quote by Rob Pike, which whether you agree with the points he makes or not, explains why Go does not have generics.
Does it? It seems more to explain why Go doesn't have C++-style classes.
In fact, this quote is almost like hearing the concept of metaprogramming being dismissed because C macros are a disaster.
> To be fair he was probably saying in his own way that he really liked what the STL does for him in C++
The C++ STL is hardly the ambassador of type theoretic solutions to problems of software complexity and safety.
> What it says is that he finds writing containers like lists of ints and maps of strings an unbearable burden.
Writing things once is not the problem. If you want to write a red-black tree of inegers, you don't want to write the whole thing again for some other totally ordered type. So you're left with casting your way out of the problem on top of a boxed implementation. Great, you've sacrificed DRY for safety and readability because a rich type system was too hard [1]. Note: almost wrote "proper type system".
> Perhaps I'm a philistine about types but I've never found that model particularly expressive.
Or perhaps Rob Pike just hasn't explored the relevant literature in enough depth. At one point he admitted that he didn't know that structural typing had already been invented previously! This isn't to criticize Rob, I find his talks fascinating, I think he's awesome, he's a friend of my boss, etc. But he's hardly the first hard-core hacker to be ignorant of the degree to which type theory has seen dramatic advances since the 1980s.
Just think of John Carmack, who after a very long and successful career using C and C++ is only now beginning to espouse the benefits of rich type systems and static analysis, going as far as to rewrite Wolfenstein 3D in Haskell.
> Type hierarchies are just taxonomy.
Here is the crux of the problem. Rob has silently switched from the ideal of "generic types" -- which 20 years of programming language research has taught us requires engaging with ideas like type classes, higher-kinded types, type covariance, and algebraic data types -- to the straw-man of "type hierarchies". Of course type hierarchies are crap. But that doesn't mean you have to return to the stone age.
Okay, well, structural typing isn't the stone age, but it's the beginning of the journey, not the end.
[1] to be fair, it is hard, Rust is still struggling to make the right balances, as Niko Matsakis's blog posts so entertainingly demonstrate.
> Here's a long quote by Rob Pike, which whether you agree with the points he makes or not, explains why Go does not have generics.
Does it? It seems more to explain why Go doesn't have C++-style classes.
In fact, this quote is almost like hearing the concept of metaprogramming being dismissed because C macros are a disaster.
> To be fair he was probably saying in his own way that he really liked what the STL does for him in C++
The C++ STL is hardly the ambassador of type theoretic solutions to problems of software complexity and safety.
> What it says is that he finds writing containers like lists of ints and maps of strings an unbearable burden.
Writing things once is not the problem. If you want to write a red-black tree of inegers, you don't want to write the whole thing again for some other totally ordered type. So you're left with casting your way out of the problem on top of a boxed implementation. Great, you've sacrificed DRY for safety and readability because a rich type system was too hard [1]. Note: almost wrote "proper type system".
> Perhaps I'm a philistine about types but I've never found that model particularly expressive.
Or perhaps Rob Pike just hasn't explored the relevant literature in enough depth. At one point he admitted that he didn't know that structural typing had already been invented previously! This isn't to criticize Rob, I find his talks fascinating, I think he's awesome, he's a friend of my boss, etc. But he's hardly the first hard-core hacker to be ignorant of the degree to which type theory has seen dramatic advances since the 1980s.
Just think of John Carmack, who after a very long and successful career using C and C++ is only now beginning to espouse the benefits of rich type systems and static analysis, going as far as to rewrite Wolfenstein 3D in Haskell.
> Type hierarchies are just taxonomy.
Here is the crux of the problem. Rob has silently switched from the ideal of "generic types" -- which 20 years of programming language research has taught us requires engaging with ideas like type classes, higher-kinded types, type covariance, and algebraic data types -- to the straw-man of "type hierarchies". Of course type hierarchies are crap. But that doesn't mean you have to return to the stone age.
Okay, well, structural typing isn't the stone age, but it's the beginning of the journey, not the end.
[1] to be fair, it is hard, Rust is still struggling to make the right balances, as Niko Matsakis's blog posts so entertainingly demonstrate.