3 ms·
But, also, number one liked issue: simplicity. The go team doesn't say they don't want generics, they say they haven't found a non-complicated way to implement
by bla2 10y ago
But, also, number one liked issue: simplicity. The go team doesn't say they don't want generics, they say they haven't found a non-complicated way to implement generics.
- coldtea 10y agoWell, I don't think there's some magic way. There are just the N ways PL research has found for implementing generics. Either they implement them, and tackle the complication one of those N ways entails, or they don't. Besides, has anyone seen much experiments, with actual coding or at least design, for finding this "non-complicated" way anyway? Not just some post once in a blue moon re-iterating the basic well known tradeoffs.
- gribbly 10y ago>Besides, has anyone seen much experiments, with actual coding or at least design, for finding this "non-complicated" way anyway? Proposal from Ian Lance Taylor, Go developer at Google https://github.com/golang/proposal/blob/master/design/15292-generics.md https://github.com/golang/proposal/blob/master/design/15292-... View of Russ Cox, Go developer at Google https://research.swtch.com/go2017#generics https://research.swtch.com/go2017#generics
- coldtea 10y agoYeah, I've read both -- and more. None of this is what I described: either actual code, even if in some experimental compiler branch/fork, or at least a concrete design. Ian's just reiterates the various options (Rob Pike has already written similar things), and Russ Cox is just several vague ideas for future additions to the language.
- deleted 10y ago[deleted]
- crypto5 10y agoSo, Russ says it is Ok to have generics but there are higher priorities. The problem with this approach is that eventually when they will add generics, there will be whole ecosystem living without them, which means this ecosystem will need to be entirely reimplemented.
- gribbly 10y agoWhy ? It's not as if the old code needs to be rewitten just because there is the option of generics.
- norswap 10y agoAdd invariant-only generic types (no subtyping relations between types with different type parameters) as a way to avoid 90% of casts. It doesn't get easier than this. As for going further, I think covariance and contravariance, while conceptually simple, will always be too complicated to wrap your head around. I think the future is invariant types + advanced generics functions. But research hasn't explored that direction yet. I might want to do that in the future. If it's relevant to anyone's interest, feel free to contact me.
- MichaelGG 10y agoYet millions of VB and C# users deal with them every day and seem to be doing fine. For a concept that's so old, it seems unlikely they're going to find some breakthrough either in implementation or language-simplicity.