While browsing the source code of the scala API I met this package definition here :
package scala.util.parsing
package combinator
package syntactical
What does that mean ? That the class will be available in more than one package ?
While browsing the source code of the scala API I met this package definition here :
package scala.util.parsing
package combinator
package syntactical
What does that mean ? That the class will be available in more than one package ?
The Scala reference mentions (chapter 9):
A compilation unit consists of a sequence of packagings, import clauses, and class and object definitions, whichmay be preceded by a package clause.
A compilation unit
package p1;
. . .
package pn;
stats
starting with one or more package clauses is equivalent to a compilation unit consisting of the packaging
package p1 { . . .
package pn {
stats
} . . .
}
See also Organizing Code in Files and Namespaces on nested packages.
This is basically the same as
package scala.util.parsing.combinator.syntactical
import scala.util.parsing._
import scala.util.parsing.combinator._
...
So by "stacking" the packages the way you wrote you can get super-packages in scope. See also these answers.
[Update] Here is a new article written by Martin Odersky about this topic: http://www.artima.com/scalazine/articles/chained_package_clauses_in_scala.html