Friday, September 24, 2004

Generics and different interpretations of backwards compatibility

From Bruce Eckel's blog - http://mindview.net/WebLog/log-0058

Going back to his disappointment at Java generics and erasure. Erasure erases the type info at runtime, so casting is done under the hood w/o programmer's knowledge. .NET retains type info as metadata and is accessible at runtime.

Interesting to see what he writes about backward compatibility. Whereas Java wants to be able to write code using Java 1.5 and be able to run it on previous VM's, .NET wants to be able to run previously developed code in the new CLR w/o recompilation. You can't run newly developed .NET code (v2) on previous versions of CLR.

I'm actually a bit confused about this. If your new Java 1.5 code can run on previous VM's then you will only be able to use the Java API from previous versions right? You can't use any new functionality added to the library. So you will need to get the new API's anyway?