Re:Go is Google's language, not ours
by jimmaswell on Wednesday May 22, 2019 @02:47PM
(#19984206)
You mean like this, right?
class A {};
class A<T> : A {};
I don't mind that. It can even be an aid to organization - all the generic stuff goes in the generic class, all the stuff that doesn't rely on that can go in the base class. But it would be nice to use something like <?>. Too bad generics don't inherit implicit casts, like A<int> to A<object>.I do mean that, and I do mind it a lot when I'm so used to just being able to erase the generic.
There are performance implications to type erasure, to be sure, but when our computers are mostly all future machines from beyond the moon, I'm more interested in minimizing the impedance between my brain and a solved problem.
Re:Go is Google's language, not ours
by jimmaswell on Wednesday May 22, 2019 @04:32PM
(#19985143)
This is the only non-bad consequence of type erasure I'm aware of. On the other hand, a lot of code I've written in C# would be impossible or severely hacky without type retention, like "new T()", "T is Thing", finding all classes that are derived from T, etc.
I do appreciate, though, that when Microsoft decided to do generics for C#, they did so decisively. These days, when C# gets a new feature, it seems like it's the complete opposite of decisively delivered.