2 ms·
What’s wrong with type erasure? It’s always get brought up, but other than missing overloading (it never occured to me, but it is at least an objective criticis
by kaba0 6y ago
What’s wrong with type erasure? It’s always get brought up, but other than missing overloading (it never occured to me, but it is at least an objective criticism), it is basically what every single language does, other than c#.
- geophile 6y agoType safety, overloading, doesn’t play well with arrays (T[]), and other baggage related to the lack of value types, (e.g. <Integer> is ok but not <int>). C++ also does not rely on type erasure.
- kaba0 6y agoWhat’s up with type safety? The only escape hatch is casting (and of course co/contra/invariance, but it is a semantic issue). Overloading may be a legit issue, but I am yet to run into it, you are right about arrays and value types, but they are being worked on and hopefully project valhalla can solve these issues. C++’s templates have different trade-offs (lack of semantic validation, though perhaps it is solved by concepts and constraints? I haven’t looked into them yet)