4 ms·
> Something I don’t see the Go team get enough praise for is their ability to bring major language changes like generics into the language in an actually backwa
by masklinn 5y ago
> Something I don’t see the Go team get enough praise for is their ability to bring major language changes like generics into the language in an actually backwards compatible minor version update.
I don't really see how that is at all praiseworthy: C# and Java already did that exact thing. Plus the entire peanut gallery has been saying generics were necessary from the very first announcement (or at least the first where readers realised there were no generics) so this is a completely self-inflicted wound.
- vanderZwan 5y ago> I don't really see how that is at all praiseworthy: C# and Java already did that exact thing. You know, in sports, when someone manages to do something only two other athletes have managed before they usually still get praised for it. I don't know if this situation is comparable to that, but my point is that I also don't see how C# and Java doing this before inherently would make this less of an achievement. Perhaps we haven't been giving those languages the praise they deserve for doing that too.
- shakow 5y agoYou know, in sports, if you finally can complete the basics known for 5 decades after years of training, no one will praise you.
- shakezula 5y agoArguing that generics are in "the basics" is a little disingenuous, don't you think? Go has been wildly successful without generics, and the designers of the language were quite intentional and opinionated in leaving them out.
- pjmlp 5y agoThe basics appeared into the scene via CLI and ML in 1976/78. Plenty of time. There were also plenty of successful languages without generics in the last century, that doesn't mean we should keep designing them.
- xh-dude 5y agoWhat frustrates me a bit about this argument is that interfaces really do offer a tool to solve problems around dispatch and polymorphism. Like a lot of things in Go there are lots of opinions and tradeoffs that can’t or can’t easily be revisited by someone using the language, but it’s a very different argument to say “I don’t like the tools the language provides” than “the language doesn’t provide x, y, z”. IMHO there are convincing arguments that Go needs x, y, z (or: prefer another language if you need x, y, z). A good example of one of these that is being addressed would be priority queues. Doing them via interfaces was always possible - there’s a whole std lib package for them. Generics will be better. But looking at the pre-/post-generic ways of doing priority queues confirms and emphasizes, rather than negates, the utility of interfaces as a way of structuring code. It’s still opinionated and I think it’s fair to argue about alternatives but it’s absolutely not the case that some large class of reasonable problems was entirely ignored or forgotten.
- pjmlp 5y agoJava pre-1.5, or Oberon derived languages, Objective-C pre-generics, C++ARM, we oldies know how it was.
- shakow 5y ago> Arguing that generics are in "the basics" is a little disingenuous, don't you think? Not really. Type polymorphism exists since the 70's, it still blows my mind that people consider that they are ‶too hard to understand for developers″, or that ‶their implementation is not very clear to language designers″. > Go has been wildly successful without generics JS have been wildly successful despite its many fundamental flaws, success is not an indicator of intrinsic quality.
- Zababa 5y ago> You know, in sports, when someone manages to do something only two other athletes have managed before they usually still get praised for it. You're talking about it like it's a time in 100m or something, while many people seem to see it as "taking less than 30 seconds to get 5 apple out of a barrel of water with your mouth, hands tied behind the back, blindfolded". Cool, but why didn't you release the generics from the beginning, especially when Java and C# added them?
- masklinn 5y ago> You know, in sports, when someone manages to do something only two other athletes have managed before they usually still get praised for it. You know, in sports, if you kept straddle-jumping until the 80s before finally transitioning to the fosbury like everyone told you for more than a decade, you wouldn't get praised for it. > I don't know if this situation is comparable to that, but my point is that I also don't see how C# and Java doing this before inherently would make this less of an achievement. Because they demonstrated it was quite reasonably feasible before Go even existed. And also because, again, Go's situation was entirely predictable and self-inflicted, and C# and Java's own transitions demonstrated it plainly.
- eitland 5y ago> You know, in sports, when someone manages to do something only two other athletes have managed before they usually still get praised for it. This is more like solving a puzzle years after others proved it solvable and after having told everyone multiple times that it didn't matter, isn't it?
- wbl 5y agoThe Go team never said it didn't matter. They said they wanted to think through the right design.
- eitland 5y agoWaiting for half a decade is a fairly effective way to tell me at least that they didn't exactly care very much about it, but it could of course be that they cared so deeply about it that they had to wait until recently before they felt it was good enough. I don't think so however and here is what Russ Cox wrote about it in 2017: > For example, I’ve been examining generics recently, but I don’t have in my mind a clear picture of the detailed, concrete problems that Go users need generics to solve. As a result, I can’t answer a design question like whether to support generic methods, which is to say methods that are parameterized separately from the receiver. (from https://go.dev/blog/toward-go2 https://go.dev/blog/toward-go2) At least the way I read the above it comes off as "doesn't matter".
- morelisp 5y agoLanguage like "self-inflicted wound" suggests there was either some strong objection to generics or that everyone was unaware they wanted them. That's not true. There's never been a strong design opposition to generics among the Go developers (note "the X developers" as distinct from the weird fanboy communities today of "X developers"), but it's always been balanced against other priorities, particularly compiler speed. C# and Java aren't quite so ready to throw stones in that area. That being said, I don't think it's some uniquely praiseworthy thing either. For me that's actually more for things like `strings.Cut`; too many languages refuse to use their stdlib as a tool to push good design, especially good "micro-design".
- pcwalton 5y agoC# and Java have very fast compilers. A JIT is generally better for compilation speed than Go's approach, as a JIT only compiles code when it's executed. javac and csc.exe don't do any up-front code generation, while Go 6g/8g does. Besides, I don't think generics particularly affected C#/Java compilation speed.
- wbl 5y agoGenerics didn't affect Java because it doesn't have them after typing: it uses erasure and generates the same bytecode as pregeneric.
- shakezula 5y agoYou're making the point about _when_ they implemented generics, and I don't care about when, really. I care about a stable language that can still move and change when necessary without breaking everything behind it, and Go delivers that. It's non-trivial to design and add a feature as core to a language as generics and make it a backwards compatible release, and you're glossing over that by saying they should've done that sooner. The matter of timing is one that the Go team has a lot of their own thoughts around, so I would defer to them on that, but as for the quality of their releases, I think they deserve more praise.
- masklinn 5y ago> You're making the point about _when_ they implemented generics I'm not, I'm pointing out that there was nothing actually exceptional or praiseworthy about it. > It's non-trivial to design and add a feature as core to a language as generics and make it a backwards compatible release So? > and you're glossing over that by saying they should've done that sooner. I'm glossing over that by saying that it's hardly novel, and that this is a self inflicted issue which dates back literally to the original language. This is a problem they were told about all along. They never had to take that risk, they decided to against advice.
- kgeist 5y ago>This is a problem they were told about all along. They never had to take that risk, they decided to against advice. They were always open to adding generics to the language, as can be seen in their FAQ from 2013 [0]: >Why does Go not have generic types? 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. [0] http://web.archive.org/web/20130118182924/https://golang.org/doc/faq#Why_doesnt_Go_have_feature_X http://web.archive.org/web/20130118182924/https://golang.org...
- masklinn 5y ago
- kgeist 5y ago>...backwards compatible minor version update >I don't really see how that is at all praiseworthy: C# and Java already did that exact thing. Not quite true for C#: generics were added in CLR 2.0, which was a major update from CLR 1.1; the runtime was considerably reworked.
- pjmlp 5y agoThe actual history goes a bit differently, they already had generics working, however they weren't stable and management didn't want to delay the initial release. https://mattwarren.org/2018/03/02/How-generics-were-added-to-.NET/ https://mattwarren.org/2018/03/02/How-generics-were-added-to...
- masklinn 5y ago> Not quite true for C#: generics were added in CLR 2.0, which was a major update from CLR 1.1; the runtime was considerably reworked. The two are unrelated.
- noisem4ker 5y agoAre they? C#'s generics required runtime support, unlike Java's, which kept bytecode compatibility through type erasure.
- skybrian 5y agoJava did this in a very complicated but backwards-compatible way. (Including bytecode level compatibility.) Here is a detailed FAQ [1] devoted to the intricacies of Java generics, covering erasure, bounded and unbounded wildcards, special cases for raw types and arrays, workarounds for primitive types, interaction with inheritance, etc. It was a big achievement, but also something to learn from. It’s reasonable that other language designers would want to do better. The C# designers tried to improve on what Java did, reconsidering many of their design decisions [2]. Apparently it was a five year effort, including inventing novel runtime mechanisms. They had different goals, particularly supporting multiple languages and cross-language compatibility. Go’s generics support is another years-long effort. They reconsidered everything again in a new context, because the Go language doesn’t have the same features or design constraints. That’s also a big achievement. This only looks like the “exact same thing” if you ignore all the history. Language design is all about the details. Every language feature interacts with every other language feature. The “peanut gallery” is a lot of random people, some of whom don’t know anything about designing or maintaining a production language. If you really want to know about this stuff, I suggest reading the papers by people who actually did it. [1] http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.ht... [2] https://mattwarren.org/2018/03/02/How-generics-were-added-to-.NET/ https://mattwarren.org/2018/03/02/How-generics-were-added-to...