Hacker News new | ask | show | jobs
by KamBha 3048 days ago
I have never really coded in C# or in the .Net platform, but I remember when it came out.

I always thought that prior to C# 1.0 being released, the Java language was stuck. There was no generics, annotations, enumerations, for/each loops or auto boxing which made programming in Java not only painful but dangerous (especially with the lack of generics and for/each). I personally, never considered anything before Java 1.5 "good enough".

I was always under the impression that these language change were in response to what C# and many of these language concepts were practically copied from C#. Is this actually the case?

1 comments

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-diffe...

https://stackoverflow.com/questions/355060/c-sharp-vs-java-g...

http://www.jprl.com/Blog/archive/development/2007/Aug-31.htm...

http://www.artima.com/intv/generics2.html

https://blogs.msdn.microsoft.com/ericlippert/2009/07/30/what...

The Pizza compiler had better generics support.

http://pizzacompiler.sourceforge.net/

But then only part of it was taken back into Java.

I 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.