3 ms·
> Generic methods are a huge win for the language. I've been waiting on these kinds of improvements to the type system ... It's funny that you and many others
by AdieuToLogic 1mo ago
> Generic methods are a huge win for the language. I've been waiting on these kinds of improvements to the type system ...
It's funny that you and many others have found the introduction of "generics" in Go to be highly valuable, considering one of the motivations for Go's existence was:
Its designers were primarily motivated by their shared dislike of C++[0]
One of the language features C++ provides, "templates", was explicitly rejected by the language authors as being antithetical to Go philosophy[1]. Thompson put it bluntly:
DDJ: In the presentation before the awarding of the Japan
Prize today, you were quoted on the distinction between
reasearch and development. [The former, Thompson stated,
was directionless, whereas development had a specific goal
in mind.] So in that context, is Go experimental?
KT: Yes. When the three of us [Thompson, Rob Pike, and
Robert Griesemer] got started, it was pure research. The
three of us got together and decided that we hated C++.
[laughter] [2]
And now, years later, generics are "a huge win."
0 - https://en.wikipedia.org/wiki/Go_(programming_language)#History https://en.wikipedia.org/wiki/Go_(programming_language)#Hist...
1 - https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html https://commandcenter.blogspot.com/2012/06/less-is-exponenti...
2 - https://web.archive.org/web/20110521080746/http://drdobbs.com/open-source/229502480 https://web.archive.org/web/20110521080746/http://drdobbs.co...
- win311fwg 1mo agoGenerics were always planned, of course: https://www.youtube.com/watch?v=rKnDgT73v8s&t=3267s https://www.youtube.com/watch?v=rKnDgT73v8s&t=3267s Rejecting templates does not mean rejecting generics.
- AdieuToLogic 1mo ago> Generics were always planned, of course ... This is provably incorrect. The position held for many years by the language authors was[0]: Generics may well be added at some point. We don't feel an urgency for them, although we understand some programmers do. 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. Meanwhile, Go's built-in maps and slices, plus the ability to use the empty interface to construct containers (with explicit unboxing) mean in many cases it is possible to write code that does what generics would enable, if less smoothly. Once the community could no longer be held back, the golang FAQ presented a very different position[1]: The Go 1.18 release added type parameters to the language. This permits a form of polymorphic or generic programming. 0 - https://web.archive.org/web/20170102202940/http://golang.org/doc/faq#generics https://web.archive.org/web/20170102202940/http://golang.org... 1 - https://go.dev/doc/faq#generics https://go.dev/doc/faq#generics
- mseepgood 1mo ago"May well be added at some point" it said and added they were at some point.
- AdieuToLogic 1mo ago> "May well be added at some point" it said and added they were at some point. That is a very selective quote which does not reflect the context I provided. So I will extract a selective quote which negates the above: We haven't yet found a design that gives value proportionate to the complexity ...
- Mawr 1mo agoI don't know how you're reading the quotes you provide, they seem to directly contradict what you're saying.
- win311fwg 1mo agoConsidering that Ian was already working on them before 1.0, and never stopped until a solution was found, we know for certain they were planned by at least one person on the Go team. If you are struggling to say that Go people are not a single monolith then sure. Nobody has ever thought people are a single monolith. However, the original announcement makes the intent of the project clear: "Not yet", not "never". They were always planned to be accepted into Go. But not before an acceptable solution was found.
- ksec 1mo agoDo we know if Go team is working in 2.0 release?
- dolmen 1mo agoWe know they aren't. They have successfully been able to add major features such as generics without breaking 1.0 compatibility, and the trend is to continue than way. Well there is no major language feature in sight in fact. Also major figures of the Go team (Russ, Ian, Rob, Ken) are gone.
- evantbyrne 1mo agoI definitely recall the days when it was not uncommon to see members of the Go community speak out against the idea of generics and other type improvements for allegedly taking away from the language's simplicity. Thankfully that faction lost that argument or otherwise changed their minds, because I have seen first hand how issues with the type system can hold back larger scale libraries.
- AdieuToLogic 1mo agoA friend of mine years ago told me, "given enough time, every programming language will evolve into a LISP[0]." I laughed at the thought in the moment and now understand the wisdom shared with me. 0 - https://en.wikipedia.org/wiki/Lisp_(programming_language) https://en.wikipedia.org/wiki/Lisp_(programming_language)