Forget about my wish list from last month. There are a few really good ideas on that list (closures and super packages). I gave up on properties. The rest is about making generic types easier to use. However, during my recent hiatus in Europe, I have been reflecting on generics. What is the problem with generics? Is it too complicated?
No doubt, generic types are relatively new in mainstream programming languages and wildcards are truly unique: it was literally invented for the Java™ programming language. This means that a lot of developers are not yet comfortable with generics. When I first heard about Object-Oriented Programming, I found it really scary. All that about inheritance, overriding, overloading, is-a, and has-a. Frankly, there is still a lot of confusion about something as fundamental as is-a, and has-a.
Most developers are very comfortable with OOP. In five years, most developers will be comfortable with generics.
Generic types are taking a lot of heat on various blogs. Not all of the critisism is without substance. I see that there is a problem when I talk to developers and close compiler bug reports as not being a bug. I see that there is a problem when trying to teach generics. I see that is a problem that causes otherwise diligent developers ignore a whole category of warnings about potential type unsafety in their programs.
The problem is the lack of reification. In other words, the lack
of runtime type-information about generic types (at runtime, you
cannot tell an ArrayList<String> from a
ArrayList<Integer>). We need to do something
about that. It is indeed time to
erase erasure!
In the next weeks I'll explain what it buys us and how we can accomplish it.
I agree with you that Java needs reified generics now.
Later it will be too late.
I have two simple questions:
Rémi
Posted by Rémi Forax on January 26, 2007 at 01:57 AM PST #
If you can do it without C++ style code bloat, that would be great, but are there not already JDK-supplied (or at least fairly standard) cllection wrappers that explicitly check types and that could therefore allow those types to be tested at runtime?
Rgds
Damon
Posted by Damon Hart-Davis on January 26, 2007 at 03:01 AM PST #
Posted by Alex Lam on January 28, 2007 at 01:31 AM PST #
Posted by Gary on January 29, 2007 at 10:52 AM PST #
Posted by 69.110.236.18 on January 29, 2007 at 10:55 AM PST #
Posted by Brent on April 25, 2007 at 07:22 AM PDT #