简体   繁体   中英

Multi-line package declaration in Scala

I was surprised to learn that there's an alternate syntax for package declaration in Scala:

package a
package b
package c

(as opposed to package abc )

What's the use case for this alternate syntax? When should I use it instead of the standard one?

What's the design rationale behind it?

You get the members of those enclosing packages as it were for free, "visible under their simple names" (9.2 of the spec).

That includes type definitions and functions in the package object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM