views:

73

answers:

2
Welcome to Scala version 2.8.0.Beta1-prerelease (Java HotSpot(TM) Client VM, Java 1.6.0_21).
Type in expressions to have them evaluated.
Type :help for more information.

scala> List(3, 1, 2).sorted
<console>:5: error: value sorted is not a member of List[Int]
       List(3, 1, 2).sorted
                     ^

Why am I getting this weird error at Scala 2.8 REPL?

A: 

just tried on 2.8.0.final


Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_21).
Type in expressions to have them evaluated.
Type :help for more information.

scala> List(3,2,1).sorted
res0: List[Int] = List(1, 2, 3)

walla
+2  A: 

In short: because you're using a very old pre-release beta of a Scala version that was explicitly refactoring the collections library. ...

So it's hardly surprising that some collection behaviour is a little rough around the edges!

Kevin Wright