Hacker News new | ask | show | jobs
by dragonwriter 3225 days ago
A Scala “object” declaration declares a singleton; it's an object, but you can also define object-specific class features.

If the instances need behavior (which in practice they often do), this is useful. Presumably, in the example, they would in a substantive program, but the behavior is irrelevant to the illustration and thus omitted.

1 comments

Interesting, thanks.