4 ms·
Yeah, it's an interesting design decision in the context of Java. There are certainly lots of Java developers who think erasure is a mistake. I think things lik
by noelwelsh 8y ago
Yeah, it's an interesting design decision in the context of Java. There are certainly lots of Java developers who think erasure is a mistake. I think things like `instanceof` are the mistake, and reifying generics is piling mistakes on top of mistakes, but then I've been hopelessly corrupted by FP. I freely admit this isn't a useful stance to take if one is focused on evolving Java as it currently exists! :-)
My above post was mostly about explaining the concept of parametricity, though, and not so much about justifying it.
- DougBTX 8y agoYes, I have to agree about `instanceof` and friends being tricky. Often they seem to come up as a quick fix for some larger architectural problem, resulting in long-term debt. The idea of inferring the set of possible implementations of a function from its signature is neat.
- jdmichal 8y agoI view non-reified types as a mistake in Java, because it's easy to work-around: <T> void doStuff(Class<T> type) There, now you are guaranteed by the compiler to have the type of `T` at runtime. With this simple a work-around, it seems silly that they just didn't properly reify them and call it a day. That being said, it's also such an easy work-around that it's simply annoying at this point when I need to include the extra parameter(s) to get the type.