Scala - Package

About

The content of a package can be scattered across many files.

Syntax

The following statement at the top of a file makes the code in a file part of the package foo.bar.

package foo.bar

Hierarchy

Package hierarchies should be reflected in directory structure.

A source file defining class myClass in package foo.bar should be stored in a subdirecotory as foo/bar/myClass.scala/

Scala does not really enforce this convention, but some tools such as the Scala IDE for eclipse might have problems otherwise.


Powered by ComboStrap