James Gosling On Generics

Here's what JamesGosling had to say about generics in Java in an interview in 1998:

Q: You spoke earlier about evolving the language and leaving things out when there were questions and the answer wasn't clear. Have other people suggested things that have taken the language in directions that you might not have anticipated?

A: There have certainly been people who have done libraries, but in terms of the language itself, no. The thing about the places where there are holes right now, they're all places where, if you look at the PhD research papers over the last 20 years, there are a lot of divided opinions and there's not a lot of clarity. For most of the holes in Java, I think you'd find that there are several PhD theses granted per topic. And one of the big holes that I get asked about a lot is something called type polymorphism. And there's probably a good couple dozen PhD theses to be granted in there.

Q: Is type polymorphism kind of like templates?

A: Kind of like templates. There's this whole category of techniques that do relatively similar things that are generally referred to as type polymorphism, where you have a type that takes as a parameter another type. Sort of like templates, except done somewhat more sensibly. The thing about templates is that they're basically just macro expanders. And they tend to get really awful compile time, compile time performance, and really awful memory consumption. They don't do for people what they'd really like. There's essentially no runtime introspection facilities in C++, so all of their type polymorphism has to be unwound at compile time, which gives you this really dramatic code bloat. But there have been other type polymorphism systems, as in languages like CLOS, BETA... But this is a whole academic area where there are a lot of arguments that go on, and we've got a couple of people at JavaSoft who are spending a certain amount of their time just running these academic arguments. The Java type polymorphism crowd gets together every few months at some conference or other. That's a particular argument that I have tried to stay out of just because it always makes my head spin.

Taken from:

http://www.javaworld.com/javaworld/javaone98/j1-98-interview.gosling-p3.html

As a postscript, it should be noted that the proposed generics system for java is based on TypeErasure, and leaves no traces at runtime.


See also GenericType, StronglyTypedCollection


EditText of this page (last edited December 4, 2003) or FindPage with title or text search