click the boxes below to see Scala in action!
Scala runs on the JVM, so Java and Scala stacks can be freely mixed for totally seamless integration.
So the type system doesn’t feel so static. Don’t work for the type system. Let the type system work for you!
Use data-parallel operations on collections, use actors for concurrency and distribution, or futures for asynchronous programming.
Combine the flexibility of Java-style interfaces with the power of classes. Think principled multiple-inheritance.
Think “switch” on steroids. Match against class hierarchies, sequences, and more.
Functions are first-class objects. Compose them with guaranteed type safety. Use them anywhere, pass them to anything.
We are pleased to announce the availability of Scala 2.12.0-M2!
We would like to highlight the following changes since M1:
As usual for milestones, 2.12.0-M2 is not binary compatible with any other Scala release, including other 2.12 milestones.
Beginning with 2.12.0-M2, the Scala 2.12 series targets Java 8. Programs written in Scala 2.12, including the Scala 2.12 compiler, can only be executed on Java 8 or newer.
Scala 2.12 is mostly source compatible with 2.11. Code that compiles on 2.11.x without deprecation warnings should compile on 2.12.x too, unless you use experimental APIs such as reflection. If you find incompatibilities, please file an issue.
Since Scala 2.11, minor releases of Scala are binary compatible with each other. Scala 2.12 will continue this tradition: every 2.12.x release will be binary compatible with 2.12.0. Milestone releases and release candidates, however, are not binary compatible with any other release.
Scala 2.12 is not and will not be binary compatible with the 2.11.x series. This allows us to keep improving the Scala compiler and standard library. We are working with the community to ensure that core projects in the Scala eco-system become available for 2.12. Please refer to this growing list of libraries and frameworks.
The Scala 2.11.1 release notes explain in more detail on how binary compatibility works in Scala. The same policies that applied to 2.11 will apply to 2.12 as well.
Future 2.12 milestones will include additional new features. For now, M2 includes the following major changes:
Scala 2.12 enables the “GenBCode” backend by default.
The new backend is more efficient than the default backend of Scala 2.11, because it directly generates ASM bytecode from Scala compiler trees, while the previous backend used an intermediate representation called “ICode”.
Scala 2.12 emits closures in the same style as Java 8.
For each lambda the compiler generates a method containing the lambda body. At runtime, this method is passed as an argument to the LambdaMetaFactory provided by the JDK, which creates a closure object.
Compared to Scala 2.11, the new scheme has the advantage that the compiler does not generate an anonymous class for each lambda anymore. This leads to significantly smaller JAR files.
As of M2, this feature is not yet on by default. You can enable it with the
-Xexperimental compiler option.
When the option is enabled, then similar to Java 8, Scala 2.12 allows instantiating any type with one single abstract method by passing a lambda. This improves the experience of using libraries written for Java 8 in Scala.
This feature was also available in Scala 2.11, also via
The GenBCode backend includes a new inliner and bytecode optimizer. The optimizer is enabled using the
-Yopt:l:classpath compiler option. Check
-Yopt:help to see the full list of available options for the optimizer.
As of M2, the following optimizations are available:
The work on the new optimizer is still ongoing. You can track it in the scala-opt repository issue tracker.
The following modules have been removed from the Scala 2.12 distribution:
scala-library-alldependency no longer include Akka actors. To use Akka, add it as a dependency.
A big thank you to everyone who’s helped improve Scala by reporting bugs, improving our documentation, spreading kindness in mailing lists and other public fora, and submitting and reviewing pull requests! You are all magnificent.
git shortlog -sn --no-merges 2.11.x..v2.12.0-M2, 40 people have contributed to Scala 2.12 so far: Lukas Rytz, Jason Zaugg, A. P. Marki, Rex Kerr, Adriaan Moors, Kato Kazuyoshi, Max Bileschi, Rui Gonçalves, jxcoder, François Garillot, rubyu, Dominik Gruntz, Evgeny Vereshchagin, Kenji Yoshida, Marc Siegel, Masato Sogame, Simon Ochsenreither, Todd Vierling, Viktor Klang, Maks Atygaev, dgruntz, harryhuk, Denton Cockburn, Paolo Giarrusso, Denis Rosset, Roman Hargrave, Antoine Gourlay, Seth Tisue, Shadaj, Alexey Romanov, Steven Scott, Tim Vergenz, martijnhoekstra, Aleksandar Prokopec, Janek Bogucki, Eugene Dzhurinsky, cchantep, Lukas Elmer, Erlend Hamnaberg, Malte Isberner. Thank you!
Thanks also to Miguel Garcia and James Iry for their substantial prior work on the new compiler backend.
You can propose edits to these release notes on GitHub.
Scala releases are available various ways, such as: