Re:Virtual Threads Arrive in JDK 21, Ushering a New Era of C...
by gpderetta on Wednesday April 12, 2023 @05:01AM
(#35536799)
No. Both type erasure and monomorphization have always been legitimate ways to compile generic code. IIRC, the issue with Java is that type erasure is sometimes a leaky abstraction.
[ Parent
| on HN ]
Re:Virtual Threads Arrive in JDK 21, Ushering a New Era of C...
by Quekid5 on Wednesday April 12, 2023 @05:49AM
(#35537190)
What exactly do you mean by "leaky" here? Can you give an example?
My main issue with non-erased generics is that they actually break reasoning wrt. parametric polymorphism as soon as you allow for pattern matching or even just .isInstanceOf on type parameters. Suddenly a function which takes a List<A> can do entirely different things depending on what A is... and that takes away a powerful reasoning tool.
Re:Virtual Threads Arrive in JDK 21, Ushering a New Era of C...
by kaba0 on Wednesday April 12, 2023 @06:01AM
(#35537282)
Itβs leaky due to reflection, but type erasure is not a problem in itself. .NET did away with type erasure, but it had a cost in terms of language ecosystem of the platform - not erasing List<A> into List will bake the variance of List into the runtime, and thus other languages have to use the same model.