[TriLUG] C++ templates and Java generics (ontopic for both lists)

Andrew C. Oliver acoliver at apache.org
Mon Jul 1 19:44:41 EDT 2002


>
>
>
>Well, as I have admittedly only seen a very early version of 
>Java generics, I can't speak to this.  I would say, however,
>that even what you seem to call "syntax candy" will help 
>with early detection of a certain class of errors.
> 
>
I think this particular implementation of Generics will actually 
increase the complexity of a number of errors.

Once again:  I thing Generics are a good thing.  I think Java needs 
them.  I just think the JSR-014 (based on GJ) is
off the mark and will create more problems than it is worth.

The reasoning behind JSR-014 is not because they (Sun) thinks that 
Runtime generics in the JVM is a bad idea or
infeasible, but that they feel the VM should be for all intents and 
purpose frozen, meaning any serious change should
be implemented outside the VM for the goal of freezing the VM.  If other 
companies held this stance for the purpose I can
only suppose is backward compatibility (because forward compatibility is 
a technically simple hurdle to cross), we'd
all be on 8086s at best by now.  

Yes, this is hard, but Java will need typedefs and Generics if it is to 
continue to grow.

>Tanner
>  
>
I'd encourage you to research the Java Generics spec (JSR-014) and if 
you come to agreeing that this is the
incorrect way to implement this please consider voting for this bug:

http://developer.java.sun.com/developer/bugParade/bugs/4487555.html
Please note the date on this bug.  I opened it about a year ago.  Since 
then I've learned a bit more about the issue
and am a bit more emphatic that this is the wrong way to do it.

You may also want to look into alternatives and ideas presented here:

http://www.research.ibm.com/people/d/dfb/papers.html#Bacon01Kava

And for the opposing viewpoints and other relvant facts:

http://www.jcp.org/jsr/detail/14.jsp - JSR-014
http://www.research.avayalabs.com/user/wadler/pizza/gj/ - The JSR is basically ripped directly from
                                                          here.
http://www.pmg.lcs.mit.edu/polyj/ - polyj (one of the other implmentations the jsr is based on)

-Andy





More information about the TriLUG mailing list