Changes between Scala 2.8 and Scala 2.9

This document will summarize the changes between Scala 2.8 and Scala 2.9 according to scala mailing lists, Scala Improvement Documents Library and Trac , etc.
Needless to say, this list has not been completed and been under progress.

If you find incorrectness, misunderstandings, etc., and something which should be listed on this page, feel free to write to @ymnk.

Parallel Collections

Generalized catch blocks

Implicit parameters with types in functions

--usebootcp and -J options

scala.sys and scala.sys.process imported from sbt.Process



Auto-Unboxing for Java Boxed values

    implicit def Byte2byte(x: java.lang.Byte): Byte
    implicit def Short2short(x: java.lang.Short): Short
    implicit def Character2char(x: java.lang.Character): Char
    implicit def Integer2int(x: java.lang.Integer): Int
    implicit def Long2long(x: java.lang.Long): Long
    implicit def Float2float(x: java.lang.Float): Float
    implicit def Double2double(x: java.lang.Double): Double
    implicit def Boolean2boolean(x: java.lang.Boolean): Boolean

Some methods added to Collections

  • Changeset 23678
    // TraversableOnce
    def collectFirst[B](pf: PartialFunction[A, B]): Option[B]
    def maxBy[B](f: A => B)(implicit cmp: Ordering[B]): A
    def minBy[B](f: A => B)(implicit cmp: Ordering[B]): A
    // Iterator
    def span(p: A => Boolean): (Iterator[A], Iterator[A])
    // Traversable
    def inits: Iterator[Repr]
    def tails: Iterator[Repr]
    def unzip3[A1, A2, A3](implicit asTriple: A => (A1, A2, A3)): (CC[A1], CC[A2], CC[A3])
    // Sequences
    def permutations: Iterator[Repr]
  • Changeset 2402
    // SeqLike
    def combinations(n: Int): Iterator[Repr]
    // mutable.SeqLike
    def transform(f: A => A): this.type
    // SetLike
    def subsets: Iterator[This]




case classes are not extendable anymore

Deprecated the @serializable annotation

  • Changeset 23627
  • Deprecated the @serializable annotation, introduce a new trait "scala.Serializable" which has to be extended instead (cross-platform).
  • Companion objects of serializable classes (including case classes) are automatically made serializable. However, they don't extend "Serializable" statically because of the known difficulty (should be done before typing, but hard).
  • Writing "case class C() extends Serializable" gives "error: trait Serializable is inherited twice"
  • Functions are serializable, but don't extend Serializable dynamically.
  • Note that @SerialVersionUID continues to be an annotation; it generates a static field, which is not possible otherwise in scala.

New commands on REPL

  • :implicits               show the implicits in scope (-v to include Predef)
    Changeset 24178
  • :javap                    disassemble a file or class name
    Changeset 24167
    Changeset 24212
  • :keybidings            show how ctrl-[A-Z] and other keys are bound
    Changeset 24146