Viewing old version c7164bd980a31813950e9dace4ca4c33d4fa9363; View Current
Scala Packages gives an overview of what packages in Scala are.
On the surface, they are a slightly more flexible version of Java’s imports:
However, this doesn’t really touch on some of the subtleties of how Scala treats packages.
Read This for a detailed overview of some very subtle behavior.
My Thoughts on this Feature
I think it’s a shame that packages in Scala are essentially packages in Java. Importing individual classes is insane, pedantic, and unhelpful to all involved. Importing in general is just a compiler hint, and, in this day and age, seems ridiculous. It’s another example of Java’s love of repeating information already given (I have to tell the JVM not just which jars I need on my classpath, but also which classes from those jars I need at compile time?!?!? Why!??!)
I think the ability to rename a class is nice, although ripe for abuse.
Scala really missed an opportunity to import packages and not just a set of classes into the namespace. Or, more precisely, to use the package mechanism to declare dependencies.
Further, the behavior described in the linked article is INSANE. Why would anyone want that behavior?
Last Updated 07/26/2009 at 08:12:17 PM by davecblog comments powered by Disqus
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.