Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 a.b.c)

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?

like image 261
My other car is a cadr Avatar asked Oct 20 '22 10:10

My other car is a cadr


1 Answers

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.

like image 105
som-snytt Avatar answered Oct 23 '22 02:10

som-snytt