Hacker News new | ask | show | jobs
by bad_user 4464 days ago
To be fair, Java's generics are so awfully implemented that I stay away from them as much as I can - i.e. invariant, with use-site variance notations by means of existential types and freaking wildcards (instead of declaration-site like how Scala does it, which is much saner).

I mean, take a look at this presentation: http://parleys.com/play/514892250364bc17fc56bb15/chapter0/ab...

And I'm not even ranting about the generics being based on type-erasure, like so many other people are doing. Type-erasure is actually one of the best features of Java, since reification implies doing damage in the runtime which would have impacted other languages and with a good type system, you wouldn't need reification anyway.

1 comments

My two major complaints with generics in Java is lack of type aliases and the whole issue with primitive types support.
In Scala you can specialize for primitives btw. It has some gotchas, but if you know what you're doing, it works OK.
Thanks for the hint.

Actually, in terms of alternative FP JVM languages, I am more into Clojure than Scala, even though I am a big ML fan.

So I my Scala knowledge is currently at Scala 2.8 level and I wasn't aware of it.