I have seen in a few libraries, Spray for example, dual package specifications like this:
package cc.spray
package http
// code
Is this just eye candy for package cc.spray.http, or is there a functional benefit to breaking the two apart like this?
That is equivalent to this:
package cc.spray.http
import cc.spray._
// implicitly, import cc.spray.http._
That is, every member of package cc.spray
and of package cc.spray.http
are visible. On the other hand, members of the package cc
are not visible.
This way one can safely use names such as java
in their package hierarchy without causing trouble, and, at the same time, easily make visible the package scopes one wants to be visible.
The separate package statements puts both cc.spray
and cc.spray.http
in scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With