Thursday, December 03, 2009

Any, Nothing, Scala and Java

The type verification engine in Scala outdoes the one in Java.

To enable this relative strength, Scala has defined, among other features, a closed type system, with the inclusion of "Any" and "Nothing".

"Any" is the super-type of all types. This is nothing new. Java has this, too, essentially speaking.

"Nothing" is the subtype of all types. When it comes to classic and modern type theory, there's nothing new about "Nothing" either. However, "Nothing"-ness is revolutionary new when thinking of how Java has treated types.

Java designers -- perhaps for the sake of the love of trees (I mean "trees" as a graph concept) and the love of "simplicity" of type system that characterizes OS and language designers wish to serve common programmers in general -- did not stipulate "Nothing". Had they done so, we would have had a completely different language in its characteristics from what became Java.

"Nothing" is a simple change but the consequences on the type system and language features are widespread.

No comments: