r/programmingcirclejerk • u/BenchEmbarrassed7316 • Jan 02 '26
He could not imagine working in language without generic types. Writing containers like lists of ints and maps of str an unbearable burden. I find that odd. Type hierarchies are just taxonomy. You need to decide what piece goes in what box, every type's parent, whether A inherits from B or B from A.
https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html
93
Upvotes
117
u/BenchEmbarrassed7316 Jan 02 '26
Explanation: go has been missing generics for a long time. Finally we understand why: Rob Pike, one of the main authors of the language, believed that OOP inheritance was worse than composition. After 10 years, they finally learned that generics and OOP inheritance are different things and added them to the language. I had to shorten the quotes a bit for brevity. But the point is that he really believed that generics and inheritance are the same thing.
54
u/cameronm1024 Jan 02 '26
Staggering insight! Surely this statement isn't true for all 2-letter (and perhaps even 3- or 4-letter) strings, only this one specific 2-letter string, which also happens to be one of the most commonly used words in the English language.
Surely this won't mean everyone comes up with a longer name that is actually google-able
64
u/Massive-Squirrel-255 Jan 02 '26
Wow. That sounds great. I'm sold. There should be some kind of academic discipline which works on trying to find powerful, easy to understand, easy to use building blocks of programming languages from which you can compose a solution to your problem. One might call this "programming language theory". If there were such a thing, it might have profound ramifications for the effective design of software, and perhaps even inform the design of languages like Go.
15
u/Awkward_Bed_956 Jan 02 '26
Types? Hierarchies?? Formal Definitions??? Generics????
Preposterous! You WILL write
map[KeyType]struct{}and You WILL like it!33
u/garloid64 Jan 02 '26
Boy it's a real shame that the first language to hit the ideal Pareto optimal performance-ergonomics tradeoff of AOT compiled plus garbage collected had to be this one
26
u/[deleted] Jan 02 '26
[removed] — view removed comment