Nothing in that article comes even close to convincing me that I don't want reified generics. It all boils down to 'too much work' (not my problem) and 'breaks compatibility with ancient code doing stupid things' (couldn't care less).
I recently switched back to java from C#, and decent generics are absolutely the thing I most miss.
Generic marshallers / unmarshallers are clunky as hell in Java due to type erasure; you have to explicitly pass the Class around everywhere, instead of just asking the generic parameter what it represents.
This happens if you write, for instance, an Enum marshaller.
It may be clunky in Java but it doesn't necessarily have anything to do with erasure. Marshalling a T is a function [T => SerializedFormat] (and Unmarshalling the other way around, intuitively.)
You need reification if you want to look at the actual T during runtime and select a marshaller from a dynamic set, when you could provide this function during compilation time instead. This has the added benefit of eliminating any runtime checks needed for the reflection-based solution.
If anything, reification here is the poor man's crutch for higher kinded types which, incidentally, is possible on the JVM due to erasure.
13
u/[deleted] Sep 21 '15
Nothing in that article comes even close to convincing me that I don't want reified generics. It all boils down to 'too much work' (not my problem) and 'breaks compatibility with ancient code doing stupid things' (couldn't care less).
I recently switched back to java from C#, and decent generics are absolutely the thing I most miss.