On 11/23/06, TSa <[EMAIL PROTECTED]> wrote:
HaloO,
Darren Duncan wrote:
> And if Seq and Set etc are interchangeable for all situations where it
> doesn't matter whether the elements are ordered or not, then a lot of
> times users won't have to care which they have.
One can argue that we have the subtyping chain Seq <: Bag <: Set for
these immutable types. The idea is that a Bag is a multiset, that is a
set that maintains a multiplicity per element.
And we may argue as well that being Bag a multiset, the set is a
special case where all the elements have the same multiplicity.
Apart from that it
behaves like Set. The Seq would add an order to the elements and some
functionality that builds on that order. The good thing would be that
Seq literals are applicable where Sets are expected.
Going from a Set to a Seq imposes some dilemma which may be though
similar to how going from a list to a scalar (it is the length, a
reference, what else?). The mapping of a Set to a Seq could be
parameterized via an ordering sub. But there are more possibilities.