Generic Java type inference is unsound
started 12/18/2001; 3:43:21 AM - last post 4/8/2003; 6:18:14 AM
|
|
Ehud Lamm - Generic Java type inference is unsound
12/18/2001; 3:43:21 AM (reads: 2225, responses: 7)
|
|
Generic Java type inference is unsound |
It is a variant of the "classic" problem with polymorphic
references in SML, which resulted in the usual array of
fixes: notably value polymorphism.
This code compiles, but produces a ClassCastException
when executed, even though there are no explicit casts in
the program.
Enough said.
Posted to theory by Ehud Lamm on 12/18/01; 3:43:29 AM
|
|
|
|
Ehud Lamm - Re: Generic Java type inference is unsound
12/18/2001; 4:36:21 AM (reads: 1263, responses: 0)
|
|
I wonder if the generic programming support design for .Net suffers from this problem.
|
|
Chris Rathman - Re: Generic Java type inference is unsound
12/19/2001; 7:29:09 AM (reads: 1187, responses: 1)
|
|
The .Net proposals are still in infancy, so they are not yet suffering. :-)
The proposals I've seen for .Net are different from Generic Java. Genericity on Java was achieved by using a preprocessor for the Java Compiler - meaning that it was more a compilation feat akin to using macros. The proposals for .Net are a bit more ambitious in that .Net is supposed to strive to be language neutral. The genericity is associated no such much with the compilation process, but rather a runtime spinning off of Generic classes. The VM becomes responsible for the dispatch.
Don't know if that makes a difference in solving the cited problem of the article.
|
|
Ehud Lamm - Re: Generic Java type inference is unsound
12/19/2001; 8:24:25 AM (reads: 1256, responses: 0)
|
|
It is true that GJ etc. are based on compilation by erasure (of type information) where as the .Net paper we linked to a couple of month ago was based no carrying type information at run time. But as far as I can tell, this doesn't rule out the possibility of having this problem.
|
|
Frank Atanassow - Re: Generic Java type inference is unsound
12/19/2001; 3:38:21 PM (reads: 1160, responses: 0)
|
|
Here is some Java trivia: I've heard from reliable sources that Martin Odersky's implementation of Pizza (and GJ) is now the compiler which is distributed by Sun, but all the parametric polymorphism code is disabled. Apparently, Sun's code was so unmanageable that Martin's compiler was a vast improvement!
|
|
Ryan Randall - Re: Generic Java type inference is unsound
12/19/2001; 11:28:38 PM (reads: 1164, responses: 0)
|
|
|
Florian Hars - Re: Generic Java type inference is unsound
3/25/2003; 6:23:12 AM (reads: 658, responses: 0)
|
|
Note that the url of the referenced article has moved from msg00851.html to msg00849.html
|
|
andrew cooke - Re: Generic Java type inference is unsound
4/8/2003; 6:18:14 AM (reads: 665, responses: 0)
|
|
I've heard from reliable sources that Martin Odersky's implementation of Pizza (and GJ) is now the compiler which is distributed by Sun
The jsr14 public draft (via http://jcp.org/aboutJava/communityprocess/review/jsr014/index.html) states: "The proposed language and library changes (except reflection) have been completely implemented in a production quality compiler. In fact, the current shipping version of javac in the J2SE 1.3 SDK is automatically derived from a compiler that accepts the extended language."
|
|
|
|