Unified Types
The Gist
Unified Types is an overview of Scala’s types and classes at a very high level.
My Intepretation
All Scala values are objects; there is no formal “primitive” type as there is in Java. However, there is a distinction in the main object tree.

Every object is a subtype of Any, however in practice, most objects will be a direct subtype of AnyRef. AnyVal is a superclass for the types that, in Java, are considered “primitive” (that being things like int, byte, and float). Further, all classes implicitly extend scala.ScalaObject (which is a trait) and AnyRef (yes, there is multiple inheritance). Finally, classes you can access from the Java runtime do not extend scala.ScalaObject, but just extend AnyRef.
My Thoughts on this Feature
Thank GOD we don’t need Java’s stupid primitive types any more (even though they are actually still there, since this is the JVM and all). However, I find the concepts of Null, Nothing, and null less than intuitive. Stuff like this just makes me scratch my head. Especially Nil being the empty list. What’s so wrong with EmptyList?
Last Updated 09/21/2009 at 03:24:13 PM by davec
blog comments powered by Disqus
All Content by David Copeland is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.