So yeah,
Everything sucks about Dart.
-notch
So yeah,
Everything sucks about Dart.
-notch
Which is also a goal for a future Java release, as announced by Oracle (don't know if they'll follow through):
Java 9 and 10 will tackle big data, multi-language interoperability, cloud and mobile and ship in 2015 and 2017 respectively, Oracle said Wednesday. For the Java Development Kit (JDK) 10 or after, a fundamental change is being discussed: making the Java language Object Oriented. This might see the introduction of a unified type system that turns everything into objects and means no more primitives.
No object/primitive distinction, but you have to explicitly make objects and methods nullable, and the dereference operator is null-safe. (You use the dereference operator on a null object, you get null. You use the dereference operator to call a nullable method on a null object, you get null. It is a compile-time error to call a non-nullable method on a nullable reference where the compiler cannot prove that it won't be null. Pure functions are implicitly nullable.)
It is a compile-time error if you assign a nullable reference to a non-nullable reference and the compiler cannot prove that it won't be null.
I've also had an idea for what I call a "pseudo-statically typed" language: instead of checking types at compile time, it checks that you implement all functions called on the parameter at compile time. Public variables are just syntactic sugar for getX/setX, operations are just syntactic sugar for addX/subX/etc. If you define a method with an input type of X, the compiler checks that you only call methods that are defined in X, and then replaces the type with the methods actually called.
But nullable "primitives" can actually be useful occasionally, for caching, for example. Having a separate boolean flag works, but can be inefficient (you can store null internally as NaN with a specific payload, for example, whereas a boolean flag generally requires at least a byte, more with alignment. This also allows easier atomic updates.)
It's a pretty good system that does what it can, but you can still pretty easily get code that violates your specified types at runtime if you go out of your way.
"I really like it." - notch