2 ms·
It would have been straightforward to copy an existing approach to generics (though I suspect that this is a usage of the word ‘straightforward’ that has curren
by foldr 3y ago
It would have been straightforward to copy an existing approach to generics (though I suspect that this is a usage of the word ‘straightforward’ that has currency only among people who’ve never written a compiler), but I’m glad they waited and did something better that had a proper theoretical foundation. If they’d naively added generic types to Go from the beginning, you can bet there would have been all kinds of interesting unintended consequences, as there were in the case of Java.
- pjmlp 3y ago"They are likely the two most difficult parts of any design for parametric polymorphism. In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier. -- https://go.googlesource.com/proposal/+/master/design/go2draft-generics-overview.md https://go.googlesource.com/proposal/+/master/design/go2draf... CLU was invented in 1976, C++ concepts were proposed in 2005!
- foldr 3y agoIf you take a step back here, the Go team acknowledged their biases and lack of in-depth knowledge in the domain, consulted with domain experts, and eventually settled on exactly the kind of generics system that you apparently approve of. Could they have done this earlier, in principle? Sure. But at what cost? What other balls would have been dropped? I think they were absolutely right to focus on aspects of the language design and tooling that they were confident about. Go is all the better for it. It's the polar opposite of a language designed to appeal to programming language enthusiasts; and well, that shows in the reactions. By all means use Rust. I use Rust sometimes too, and it has its advantages over Go. Personally, I find generics in Go an occasional convenience and missed them only a little before 1.18.