4 ms·
That can be done even more easily with properly erased generics. This is another of those unfortunate implications of Java's having disappeared into this ugly
by bunderbunder 8y ago
That can be done even more easily with properly erased generics.
This is another of those unfortunate implications of Java's having disappeared into this ugly chasm between static and dynamic typing. It doesn't fully erase types, so you can't do like C++ or Haskell do and just generate a completely different type, because it wouldn't be compatible with any functions that work with the generic type. At least, not without breaking backward compatibility, which was the whole point of doing type erased generics in the first place.
- dtech 8y agoI'm curious, what is not "proper" about Java's erased generics? Reified types also bring other advantages, e.g. runtime reflection can be useful and can enable meta-programming and allows check binary compatibility of dynamic linking. So gives that you want a language with reified types, losing that reification with generics creates awkward cases in the languages and prevents possibility for optimization.
- bunderbunder 8y agoThey're not erased all the way, they're only erased down into the root type for all objects. So you've still got some type information left (namely, that it's an Object), and any types that are not Objects are officially banned from the generics system. Hence the need to dress them up as washerwomen and sneak them in through the service entrance.
- slavapestov 8y ago> This is another of those unfortunate implications of Java's having disappeared into this ugly chasm between static and dynamic typing. It doesn't fully erase types, so you can't do like C++ or Haskell do and just generate a completely different type, because it wouldn't be compatible with any functions that work with the generic type. Full monomorphisation is not compatible with separate compilation though.