I go with "premature optimization is the root of all evil", so
abstract wins. And, yes, it would be much better if Seq was immutable.
Hopefully we can fix this in some future iteration of the stdlib.
Btw, choosing collection.Seq as the default was motivated by the fact that
vararg parameters are specified to be Seq's, so
def f(xs: String*): Seq[String] = xs
must be typeable. But Java varargs are passed as arrays, which are
mutable, and the standard wrapper from arrays to sequences also
produces a mutable Seq. All this did not fit with immutable.Seq, so
defining
type Seq = scala.collection.immutable.Seq
in package scala was an easy way out. I think the right approach
should be to support an immutable Array as a separate type. This is
harder to implement, and will most likely require some compiler
support. But then varargs could be immutable arrays, and there would
be no problem to map this to an immutable Seq. So I think that's the
right thing to do.
- Martin
> You received this message because you are subscribed to the Google Groups
> "scala-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
scala-user+...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
Martin Odersky
EPFL