We are proud to announce the availability of Scala 2.12.0!
We would like to thank our many community contributors for their hard work and dedication, from kindly helping others on the forums, reporting bugs, helping us polish our documentation, to committing 32% of the changes that make up Scala 2.12! The Scala team at Lightbend (Adriaan, Jason, Lukas, Seth and Stefan) contributed 64% of the commits, and EPFL implemented the remaining 4%.
The Scala 2.12 compiler has been completely overhauled to fully leverage the new VM features available in Java 8:
FunctionN
classes in Scala's standard library are now SAM types. In fact, the compiler treats a Java-defined SAM just like our familiar FunctionN
, from type checking to code generation.Together, these changes have resulted in significant reductions in byte code in many real world projects. The biggest reduction comes from our use of invokedynamic
and Java 8's standard MetaLambdaFactory
to avoid emitting an anonymous class for each function literal (lambda). For performance reasons, we've opted to emit slightly more synthetic methods (called forwarders) than strictly necessary in our trait encoding, because they proved to reduce the JVM's startup cost.
Scala 2.12 also ships with a powerful new optimizer! Many more (effectively) final methods, including those defined in objects and traits, are now inlined. As well, closure allocations, dead code and box/unbox pairs are eliminated more effectively. We're grateful to Miguel Garcia for his initial work on this new optimizer while at EPFL.
Other changes under the hood include an improved encoding of lazy val
s defined in methods, which was -- along with the trait and lambda encodings -- developed in fruitful collaboration with Martin Odersky's Dotty team at EPFL (Dotty is an incubator for next-generation features for Scala).
In addition to first-class support for lambdas, we believe Scala offers the best functional programming experience for pragmatic programmers by deeply integrating:
Code compiled on 2.12 requires a Java 8 runtime. Any modern build tool will work, but we recommend using sbt 0.13.13 for the best experience. Because Scala 2.12 maintains source compatibility with 2.11, cross-building for both 2.11 and 2.12 is a one-line change to most sbt-based projects. You may need to make some changes if you are using experimental features such as macros, or have not caught up with deprecation warnings.
To facilitate upgrading to Java 8 and Scala 2.12, this Scala release focuses on internal compiler improvements. We have delayed our usual removal of deprecated members until Scala 2.13, which will focus on library improvements. We did fix some bugs that may require small changes to your code (please consult the full release notes for details). Where needed, sbt provides support for version-specific source folders. We recommend upgrading to sbt 0.13.13 for templating support using the new command, faster compilation, and much more!
We're also pleased to announce the immediate availability of Akka 2.4.12 for Scala 2.12. A release of akka-http will follow shortly. Play 2.6 (Q1 2017) will target Scala 2.12, and a Play 2.5 version for Scala 2.12 is actively being worked on. We're maintaining a full list of all community projects for Scala 2.12.
From now on, 2.12.x releases will be fully binary compatible. This release is identical to 2.12.0-RC2.
Our roadmap lists the following upcoming releases for 2016: 2.12.1 will be out shortly (by the end of November) to address some known (but rare) issues in 2.12.0, and 2.11.9 is the last planned 2.11.x release (due by mid December). Finally, we at Lightbend are excited to share our plans for Scala 2.13 with you in a few weeks! (Spoiler alert: we will focus on compiler performance and library evolution.)
For more information, please consult the full release notes.
We hope you will enjoy this Scala release and wish you a smooth upgrade from Scala 2.11.