3 ms·
In the case of generics, C# got them right (but required changes to CLR 2.0) and then Java tried to copy the idea (without requiring any changes to the JVM) but
by DonHopkins 9y ago
In the case of generics, C# got them right (but required changes to CLR 2.0) and then Java tried to copy the idea (without requiring any changes to the JVM) but fucked them up. Look up "type erasure": Java's underlying compiled classes weren't actually generic, and generics compiled down to "Object" and casts (which are less efficient, and can be subverted at runtime). Generics were implemented by the Java compiler, not the JVM runtime.
https://stackoverflow.com/questions/31693/what-are-the-differences-between-generics-in-c-sharp-and-java-and-templates-i#31866 https://stackoverflow.com/questions/31693/what-are-the-diffe...
https://stackoverflow.com/questions/355060/c-sharp-vs-java-generics https://stackoverflow.com/questions/355060/c-sharp-vs-java-g...
http://www.jprl.com/Blog/archive/development/2007/Aug-31.html http://www.jprl.com/Blog/archive/development/2007/Aug-31.htm...
http://www.artima.com/intv/generics2.html http://www.artima.com/intv/generics2.html
https://blogs.msdn.microsoft.com/ericlippert/2009/07/30/whats-the-difference-part-one-generics-are-not-templates/ https://blogs.msdn.microsoft.com/ericlippert/2009/07/30/what...
- stmw 9y agoI am glad you're pointing this out, because the limitations of the JVM are often overlooked as a big reason for why "we can't have nice things" in Java.
- pjmlp 9y agoThe Pizza compiler had better generics support. http://pizzacompiler.sourceforge.net/ http://pizzacompiler.sourceforge.net/ But then only part of it was taken back into Java.