I've noticed that the Scala standard library uses two different strategies for organizing classes, traits, and singleton objects.
Using packages whose members are them imported. This is, for example, how you get access to
scala.collection.mutable.ListBuffer
. This technique is familiar coming from Java, Python, etc.Using type members of traits. This is, for example, how you get access to the
Parser
type. You first need to mix inscala.util.parsing.combinator.Parsers
. This technique is not familiar coming from Java, Python, etc, and isn't much used in third-party libraries.
I guess one advantage of (2) is that it organizes both methods and types, but in light of Scala 2.8's package objects the same can be done using (1). Why have both these strategies? When should each be used?