I\'ve recently started learning Scala and was disappointed (but not surprised) that their generics are also implemented via type erasure.
My question is, is it possi
To complement oxbow_lakes answer: It is no possible and it seems it will never happen (at least soon).
The (refutable) reasons JVM will not support reified generics seems to be:
References:
Odersky comment in 2010: "I prefer a simpler VM architecture with type erasure"
In scala-internals list (Feb 2013) Grzegorz Kossakowski said:
You can easily benchmark it and see that performance impact is very noticeable. Especially memory consumption increases a lot.
I believe the way to go is to have optional reification the way we start to do in Scala with Manifests/TypeTags.
If you can and combine it with runtime specialization you can aim for high performance and generic code. However, that's probably goal for Scala 2.12 or 2.13.