My other car is a cadr
My other car is a cadr

Reputation: 1431

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?

Upvotes: 5

Views: 766

Answers (1)

som-snytt
som-snytt

Reputation: 39577

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.

Upvotes: 3

Related Questions