Scala Packages
Viewing old version efaae19870ed0cace6abb703165371edd03668b7; View Current
The Gist
Scala Packages gives an overview of what packages in Scala are.
My Interpretation
On the surface, they are a slightly more flexible version of Java’s imports:
You can also import packages anywhere you want, and those imports will be applied to the given scope. This lets you keep code a bit cleaner by reducing the scope of available symbols and classes to only the most minimal.
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’m not a fan of imports and I, while Scala breaks the “packages are just directories on the filesystem” concept, I think a higher level abstract should’ve been created.
That being said, Scala 2.8 should provide something like this.
Scala also relies much more heavily on so-called “static imports” to make the syntax more compact (specifically with ImplicitMethods).
I do think the behavior outlined in the linked blog article is a bit crazy.
Last Updated 08/12/2009 at 10:01:20 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.