After a Quiet 2015 Martin Odersky Outlined Significant Plans for Scala at Scala Days New York
[Note: this article by Michael Redlich originally appeared on Infoq.com]
After a relatively quiet 2015, father of Scala Martin Odersky announced during his May 9, 2016 keynote address at Scala Days New York, that development is “heating up” for Scala this year. Odersky, who is currently programming research group professor at the École Polytechnique Fédérale de Lausanne (EPFL), and chairman and co-founder of Lightbend, outlined “what has recently happened or will happen very soon”:
- The Scala Center
- Scala 2.12
- Plans to rethink the Scala libraries
- Development of new target platforms
- DOT and Dotty
We present a round-up of all the major announcements here
Odersky introduced the new Scala Center, chartered to “undertake projects that benefit all of the Scala community.” Due to an increase in available Scala positions, as well as a Google search on “scala tutorial,” indicating a steady rise in adoption to Scala, the Scala Center was created to focus on the open source community and education. It was also created to maintain customer support as noted in a March 14, 2016 Scala Center blog post:
The large user base and the diversity of projects built on Scala mean that there are many demands on the language and its tool set. There is also a large pool of capable and motivated contributors. The first mission of the Scala Center is to consult with the user community, define common goals, and organize contributions and its own resources to achieve these goals.
According to Lightbend’s case studies, 62 companies are committed to Scala and its related technologies.
The Scala Center is located at EPFL and is led by research scientist Heather Miller, who serves as executive director. Adriaan Moors, Scala tech lead at Lightbend, serves on the board of the Scala Center. He spoke to InfoQ regarding Lightbend’s involvement with the Scala Center. When asked if Lightbend’s day-to-day activities have been affected by the Scala Center, Moors said:
It’s influencing our planning, but it’s too early to say it’s really impacted our daily work so far. The whole Scala team at Lightbend is completely focused on getting the best possible 2.12.0-RC1 release out in the next few weeks, and this is something we remain solely responsible for (with many contributions from the community, of course!).
The road to Scala 2.12 has been on-going for two years and is scheduled to be released in mid-2016 (Scala 2.12.0 milestone 5 was available since June 29, 2016). It will be the first Java 8 optimized release and will utilize Java 8’s lambdas to produce shorter code and faster execution. Scala 2.12 has 33 new features documented in the Scala GitHub repository. Lightbend will provide an extended maintenance cycle for Scala 2.11 for applications still running with Java 6/7.
A calculus is a kind of mini-language that is small enough to be studied formally. Translated to Scala notation, the language covered by DOT is described by the following abstract grammar:
As defined in the DOT calculus GitHub repository, the abstract grammar above is:
A minimally complete version of dependent object types. The calculus comprises functions, labeled types and terms combined through intersections, recursive bindings, and nothing else.
The DOT calculus was chosen so that formal statements can be made and proved along with encoding the rest of the language in it. This provides more confidence in future development of Scala. The calculus allows for type soundness. Typing rules assign types to terms and evaluation rules ensure correct evaluation of a program as the following property demonstrates:
If term t has type T, and evaluation of t terminates, the result will be a value v of type T.
The importance of this as Odersky explained, “It gives us a technique to reason about correctness of other language features.”
Dotty is a new compiler using the internal data structures of DOT. Its code base is almost half the size of the current nsc compiler and promises to be twice as fast. Dotty will include a host of new features:
- Intersection types (corrects an issue with types not being commutative)
- Union types (avoids huge construction overhead)
- Function arity adaption (more efficient parameter mapping)
- Trait parameters (trait being synonymous to an interface in Java)
- @static methods and fields
- Multiversal equality (operators, such as == and !=, are now type safe)
- Named type parameters
Motivations for these new features include a better foundation and a language that is easier and safer to use. The current status of these features can be found on the Dotty website.
To keep the language simple, Odersky announced that some current features of Scala will be dropped:
- Procedure Syntax (not very efficient)
- DelayedInit class (wasn’t being used)
- Macros (experimental and not in the long-term plan)
- Early initializers (replaced by Trait parameters)
- Existential types (didn’t fit with Scala foundations)
- General Type Projection (determined to be type un-sound)
Some of these features will be replaced by the new ones or simply eliminated.
Advanced tooling for Dotty include:
- Basic integration with Scala’s sbt build tool
- Interactive REPL (read-eval-print-loop) with syntax highlighting
- A new IntelliJ Dotty plug-in
- Document generation (dynamic hyperlinks for cross-linking libraries)
- A new efficient and more robust linker
Dotty is built as shown in the diagram:
A new serialized typed abstract syntax tree, TASTY, is introduced and is designed to be compact, lazy, extensible, and precise. Dotty is being developed at EPFL, but the Scala team at Lightbend will be responsible for infrastructure, reviews, and suggestions. Source code can be found on the Dotty GitHub repository.
Scala 2.12 and Beyond
Planning ahead for Scala 2.13, the focus will be to study ways to revamp the libraries to make them easier to use while removing any existing corner cases. Odersky stated that inspiration came from Spark’s implementation of collections with their Resilient Distributed Datasets (RDDs) to lazily construct collection operations.
For better modulation of the Scala libraries, Odersky proposed a split of Scala stdlib:
Odersky invited developers to participate in existing and new strawman proposals.
Lightbend told InfoQ that, later this summer, they are “planning to unveil the findings of a survey of a couple thousand Java and Scala developers sharing their experiences around containers, microservices, cloud-native applications and some other hot areas.”