On Fri, Jun 24, 2011 at 2:05 AM, Russel Winder <[email protected]> wrote:
> On Thu, 2011-06-23 at 13:41 -0700, Cédric Beust ♔ wrote: > [ . . . ] > > > > Indeed, and he's not alone. There is a lot of misinformation going on, > > claiming that erasure was a terrible mistake. From what I've heard, > > most experts agree that it was actually a pretty sensible decision, > > both from a technical and backward compatibility standpoint. And there > > are actually very few languages that support truly reified generics. > > > > Perhaps there is a document somewhere that explains why erasure is a > good idea. My experience is that generics using type erasure is > painful, causes people to have to use lots of hacks that should never > have to be just to get type information to runtime, and the various > different compilers still get this variously wrong at least at warning > level. I'm having a hard time believing that a lot of Java developers are having problems because of erasure. First of all, reflection is a rare need and I am speculating that pretty much only authors of frameworks might occasionally need it. In the situations where you do need reflection, needing full access to the erased type is even more rare. If you do need it, getActualTypeArguments() may be enough. If it's not enough, you can use an approach similar to Guice's TypeLiteral. Only if none of the above is applicable to you do you really need reified generics. Seriously, how vanishingly small is the audience, given all the above? And under what circumstances would it be positively impossible for you to use TypeLiterals? If you are or have been in this situation, I'd love to hear from you (I'm guessing the likeliness is high that someone on this mailing-list might have a case for this). And if you are, obviously, you worked around it. What does the workaround look like? How much easier would it have been with reified generics? -- Cédric -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
