BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Scala 2.11: The Latest Major Scala Release

Scala 2.11: The Latest Major Scala Release

This item in japanese

Lire ce contenu en français

Typesafe has recently announced the release of Scala 2.11 under the standard 3-clause BSD license. This is a major release which includes improvements in scalac, the REPL, packaging/modularization, macros, the Collections library, and various bug fixes. Scala 2.11 targets Java 6, with only limited, experimental support for Java 8. Scala 2.11 is not binary compatible with the 2.10 series, but code that compiles on 2.10 without deprecation warnings should compile on 2.11.

Here are some of the new features in the 2.11 series.

Collections. List map, flatMap, and collect have improved performance. Immutable HashMap and HashSet are faster, and has lower memory footprints. Mutable LongMap and AnyRefMap have been added for improved performance when the keys are Long or AnyRef.

Compiler. Incremental and batch compilation have been improved. The experimental .NET backend has been removed. -Xlint have been updated, like the addition of unused terms, types and imports warnings. GenBCode has been introduced, which is an experimental back-end and optimizer for scalac. Using the experimental -Ydelambdafy:method, anonymous functions are compiled faster with smaller bytecode. There is also branch elimination through constant analysis.

REPL. The interpreter is now a JSR-223 compliant scripting engine. The disassembler command :javap now works with Java 7. The new command :kind helps tell ground types from type constructors.

Modularization. The modules for XML, parsing, Swing, and Continuations have been moved out of the core Scala standard library. The modules are available individually or via the scala-library-all, which aggregates the modules that constitute a Scala release. The compiler has also been modularized internally, separating the presentation compiler, scaladoc and REPL. These compiler modules will be in separate JARs in Scala 2.12.

Macros. Quasiquotes has been added, which is an easy to use notation to manipulate Scala syntax trees. There are also a number of significant changes to reflection and macros that Scala metaprogrammers should know about. More information can be found from the Macros: Changes in Scala 2.11 page.

Since Scala 2.11 is not binary compatible with 2.10, you will need to update your build to use 2.11 dependencies. You can view the list of Scala projects that have already been released against 2.11, in the Available projects section of the Scala 2.11 release notes. There are also a number of deprecations, which you can read more about in the Deprecations section. For example, scala-actors, scala.concurrent.future, and scala.concurrent.promise are now deprecated.

To get started, you can use the Typesafe Activator Hello Scala 2.11 template. The Scala IDE for Eclipse is available from the Scala 2.11 update site for Eclipse 4.2/4.3 (Juno/Kepler). If you are upgrading from Scala 2.10, it is recommended that all deprecation warnings are addressed before the upgrade. If you are using the XML, parsing or Swing modules, you will need to add these dependencies explicitly. For those who are not yet ready to upgrade, please note that the 2.10 series now goes into maintenance mode, and will likely conclude by the end of 2014 with version 2.10.5, two years after the initial 2.10.0 release.

Rate this Article

Adoption
Style

BT