by SemanticFog · 15y ago · 0 comments
* Lack of first class functions
* 'null' type
C# has fixed both of those.
Scala can evolve at a much faster pace than Java as well, given that the core language is tiny and most of the language constructs are implemented as libraries.
We weren't certain that C# needed it. Until we tried it.
Value types (so you can have complex data types that are never null)
Nullable value types (T? or Nullable<T>)
Null coalescing operator
Using those three features appropriately makes it a lot easier to avoid unexpected nulls causing bugs in your software.
http://stackoverflow.com/questions/178026/why-is-null-presen...
For example, in the type system we do not have separation between value and reference types and nullability of types. This may sound a little wonky or a little technical, but in C# reference types can be null, such as strings, but value types cannot be null. It sure would be nice to have had non-nullable reference types, so you could declare that ‘this string can never be null, and I want you compiler to check that I can never hit a null pointer here’.
50% of the bugs that people run into today, coding with C# in our platform, and the same is true of Java for that matter, are probably null reference exceptions. If we had had a stronger type system that would allow you to say that ‘this parameter may never be null, and you compiler please check that at every call, by doing static analysis of the code’. Then we could have stamped out classes of bugs.
I favor switching the language/environment once you feel that you need more expressing power. E.g. use Scala, Jython or Clojure if you need JVM, or perhaps Erlang for server-side.