Re: Breaking the Java Type System

Daniel Bonniot <[email protected]> Thu, 21 Apr 2005 23:55:09 +0200
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Note that I could only read the presentation, as the paper does not seem to be 
publicly available.

> Do similar problems exist for Nice?

slide 10: no such problem in Nice. We don't have Java's raw types, which are 
indeed unsafe.

slide 11: it's not clear what the problem is. Does javac reject that program? 
Nice will accept it, and will do the right thing.

slide 12: so, you can do unsafe things with reflexion. Did anybody not know 
that yet?

slide 13: covariant arrays: they are indeed unsafe, and Nice does not have 
this problem.

slide 14: not clear what the problem is. Does javac reject the program when 
the last method is uncommented? Nice handles it correctly (and discovers the 
potential null pointer exceptions, of course ;-)

slide 15: raw types, not in Nice.

slide 16/17: serialization is not safe. Again, that's no big news. It's not 
safe in Ocaml either, or probably all general purpose languages.

I did not include slide 9, since it's a variation of 10, but not very 
convincing: it includes a cast, an programs with casts can fail. Same thing in 
ML, OCaml, Haskell, ... I see that it looks like if the code goes there, the 
cast should be valid, but really this problem is then exactly the same as 
slide 10.


In summary, the brokenness of the Java type system does not happen in Nice, 
which does not allow two unsafe features of Java: raw types and covariant 
arrays. Casts and serialization are indeed unsafe, but that's the case in all 
languages. In addition, if I understood right, Java's erasure mechanism has 
severe limitations that do not exist in Nice.

Cheers,

Daniel


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click