Bill Venners posted another great article on artima.com, this one the 7th in a series of conversations with Anders Hejlsberg. If you’re not familiar with generics, Anders provides a quick introduction and then dives into explaining how C# generics were implemented and compares that implementation to Java’s implementation in Tiger.
Specifically, Java’s implementation doesn’t “… get any of the execution efficiency that I talked about, because when you compile a generic class in Java, the compiler takes away the type parameter and substitutes Object everywhere.” Additionally, the Java implementation loses the generic type information at runtime, which means that performing reflection on a generic leaves you with an array or a List of type ‘Object’, rather than the type specificed at compile time.
One of the takeaways appears to be that the Java team made it a design goal to enable generics to run on an unmodified VM (ie: they cared about backward compatability) while the Microsoft team made their changes with knowing that they could simply release a new version of the .NET runtime, with no regard to making it backward compatible. (am I right?) So in this case it seems that having a smaller installed base enables the .NET team to make more radical changes to their product, effectively alienating a smaller group of people than the Java team, who must consider a large install base and a large group of alienated users.