Monday, August 11, 2014

Scala: the unification church of Java

What Scala unifies in Java

Java has three namespace: package, method, and fields.
Scala unifies all terms under the "uniform access principle".

Java handles primitive types irregularly (eg. boxing and unboxing).
Scala unifies all types under a single-object model.

Java handles Arrays irregularly (eg. without type erasure).
Scala unifies Arrays with other collections.

Java handles void, null and non-termination irregularly.
Scala handles Unit, Null and Nothing in the type system.

What Scala diversifies from Java

Java has insufficient granular access control.
Scala creates a bunch of new access levels.

Java has single inheritance.
Scala allows you to have as many super-classes as you like.

Java has no bottom types.
Scala has Null and Nothing.

Java only has strict evaluation.
Scala has by-name parameters, lazy vals, streams, views, etc.

Java only has invariant type parameters.
Scala has definition-site variance.

Java doesn't support meta-programming.
Scala support macros (experimental).