Scala 2.11

Jason Zaugg

2.11 Themes

  • Faster
  • Smaller
  • More stable

2.11 Non-Themes

  • New language features

Faster: Collections

Faster: Incremental compilation

  • Idea: Index the identifiers in each file
  • Exploit this to prune compilation batches
  • Works with 2.10.x and 2.11.x
  • Future fixes for some corner cases only in 2.11.x

Faster: Backend Renovations

  • -Ybackend:GenBCode streamlined, parallelizable. Details
  • -Ydelambdafy:method smarter compilation of lambdas
  • Currently only for early adopters
  • Improvements scheduled for 2.11.{1, 2}
  • Enabled by default in 2.12

Faster: Batch compilation

  • Profiling and tuning the compiler
  • Big wins seem elusive...
  • ... but there are gains on offer.

Faster: Batch compilation

The inches we need are everywhere around us. They are in every break of the game every minute, every second.

On this team, we fight for that inch.

Faster: Batch compilation

Smaller: Standard Library

  • Reduced scala-library.jar by spinning out modules for -xml, -parser-combinators, -continuations
  • Modules are plain-old-SBT projects in dedicated git repos
    • Lowers barriers to contribution
    • Lowers barriers to new modules

New module: scala-pickling

import scala.pickling._
import json._

// Pickle to a JSON string
val pckl = List(1, 2, 3, 4).pickle

// Unpickling is just as easy:
val lst = pckl.unpickle[List[Int]]

Status: incubating

New module: scala-async

import scala.async.Async.{async, await}

val future = async {
  val f1 = async { ...; true }
  val f2 = async { ...; 42 }
  if (await(f1)) await(f2) else 0

Status: hatched!

Smaller: Collections

Smaller: Compiler

  • Enforce modularity for REPL, presentation compiler, Scaladoc
  • Removed the experimental .NET support
  • Remove legacy pattern matcher, bytecode emitter
  • Search and destroy mission for ~5000 chunks of dead code. #1648

Stabler: Infrastructure

Stabler: Community Build

  • Idea: use the open source ecosystem as a regression suite
  • Tooling rewires dependencies of builds
  • Daily build of almost 1M LOC (specs, scalatest, akka, play, slick, shapeless, spray ...)
  • Helped us spot critical bugs before the release

Stabler: Bug fixin'

  • SI-261 (!) private vals in traits depend on composition order
  • SI-3452Java interop: wrong generic signatures
  • SI-7296 Case classes with > 22 parameters are now allowed.
  • Plug holes in soundness checks SI-7872 SI-7756
  • SI-3346 Implicit arguments of implicit conversions now guide type inference.
  • 613 tickets closed exclusive to 2.11.0

Stabler: Macros / Reflection

Upgrade Tips: Before you upgrade

  1. Address deprecation warnings you encounter against 2.10
  2. Consider moving to the latest 2.10 releases of your open source libraries

Upgrade Tips: Switch to 2.11

  1. Read through the release notes on
  2. Update to 2.11 builds of your dependencies
    • e.g. Search for `scalatest_2.11` in Sonatype
  3. Using XML (literals/library), Swing, Parsers?
    • Add dependencies on those libraries. Sample
  4. Have you defined macros?
  5. Take note of new deprecation warnings issued under 2.11
  6. Problems? Ask on scala-user or Stack Overflow.

Themes for next 12 months

  • Java 8

  • Scala for everyone

    • More docs, tutorials, samples
    • compiler-as-a-platform for type-aware lint tools
    • faster compiler (which everyone wants!)
    • Easier scala version upgrades

Get Involved!

  • Try out Scala right now Typesafe Activator
  • Download a distribution from
  • Join our mailing list or find a local user group
  • Sign up for a free Coursera class: FP in Scala or Reactive Programming
  • Become a contributor to Scala!
  • Be part of the fifth annual Scala Days