4 ms·
C# is years ahead on the language feature side: - lambdas - Expression trees - sensible operator overloading - value type semantics (you can define your own
by thomasz 13y ago
C# is years ahead on the language feature side:
- lambdas
- Expression trees
- sensible operator overloading
- value type semantics (you can define your own types that behave like primitives)
- reified generics instead of type erasure, which means that you can have an <int,int> table (just two ints instead two pointers to Integer)
- "async monad" baked into the syntax
On the other hand, Java wins easily on the open source lib count
- sdegutis 13y agoThe way I heard it put some time ago was, Java/JVM couldn't make some important changes because it would break backwards compatibility in an unacceptable way (I'm assuming this means there are mission critical apps written in Java 1 that the whole world depends on), but since C#/.NET were from scratch, they were free from this legacy baggage and could take huge steps forward.
- MichaelGG 13y agoThe JVM didn't want to break compat to add generics into the runtime, hence they adopted the erasure model. Other language features are still quite doable on top of the JVM (as evidenced by plenty of more advanced languages targeting the JVM). Yes, the CLR gets a major advantage by having a better bytecode language design, but it can't be the real reason Java didn't get lambdas until Java 8.
- ygra 13y agoActually, .NET was in pretty much the same place, because generics were only implemented in .NET 2. They chose to add the support directly to the VM, though and break compatibility. That being said, Java broke other things along the way back then, if I remember correctly, so in hindsight type erasure for fake generics was maybe not the smartest choice.
- tejinderss 13y agoJava 8 supports lambdas
- thomasz 13y agoI know. But it's not even released yet, and it takes a lot of time for such massive changes to ripple through until you can expect them to be useful for the general public: Developers need to be trained, documentation, tools and libraries updated and hyper conservative tech leads persuaded or dethroned.