Not all scala types may be empty. In particular, Any has two children: AnyRef and AnyVal. AnyRef can handle null types. AnyVal types can be primitives on the JVM and therefore cannot be null. Implicit is deferred type checking, which allows Option [String] to use orNull, but not Option [Int].
Note. This dichotomy of an Int object, where the boxed object / primitive / unboxed has very strange manifestations in Scala, such as null.asInstanceOf [Int] == 0 // true.
jsuereth
source share