|
| 1 | +--- |
| 2 | +layout: blog-detail |
| 3 | +post-type: blog |
| 4 | +by: Martin Odersky |
| 5 | +title: "Towards Scala 3" |
| 6 | +--- |
| 7 | + |
| 8 | +Now that Scala 2.13 is around the corner, it's time to consider the |
| 9 | +roadmap beyond it. It's been no secret that the work on Dotty over the |
| 10 | +last 5 years was intended to explore what a new Scala could look |
| 11 | +like. We are now at a stage where we can commit: Dotty will become |
| 12 | +Scala 3.0. |
| 13 | + |
| 14 | +Of course, this statement invites many follow-up questions. Here are |
| 15 | +some answers we can already give today. We expect there will be more |
| 16 | +questions and answers as things shape up. |
| 17 | + |
| 18 | +_When will it come out?_ |
| 19 | + |
| 20 | +The intent is to publish the final Scala 3.0 soon after Scala 2.14. At the |
| 21 | +current release schedule (which might still change), that means late |
| 22 | +2019 or early 2020. |
| 23 | + |
| 24 | +_What is Scala 2.14 for?_ |
| 25 | + |
| 26 | +Scala 2.14's main focus will be on smoothing the migration to Scala |
| 27 | +3. It will do this by defining migration tools, shim libraries, and |
| 28 | +targeted deprecations, among others. |
| 29 | + |
| 30 | +_What's new in Scala 3?_ |
| 31 | + |
| 32 | +Scala has pioneered the fusion of object-oriented and functional |
| 33 | +programming in a typed setting. Scala 3 will be a big step towards |
| 34 | +realizing the full potential of these ideas. Its main objectives are |
| 35 | +to |
| 36 | + |
| 37 | + - become more opinionated by promoting programming idioms we found |
| 38 | +to work well, |
| 39 | + - simplify where possible, |
| 40 | + - eliminate inconsistencies and surprising behavior, |
| 41 | + - build on strong foundations to ensure the design hangs well together, |
| 42 | + - remove some language constructs that proved to be not essential, |
| 43 | + - include some new constructs that improve the language’s consistency, safety, ergonomics, and performance. |
| 44 | + |
| 45 | +The main language changes, either implemented or projected, are listed |
| 46 | +in the [Reference section on the Dotty website](http://dotty.epfl.ch/docs/reference/overview.html). |
| 47 | +Many of the new features will be submitted to the SIP process, subject to |
| 48 | +approval. |
| 49 | + |
| 50 | +_What about migration?_ |
| 51 | + |
| 52 | +Scala 3 is neither source nor binary compatible with Scala 2. However: |
| 53 | + |
| 54 | + |
| 55 | + - Scala 3 code can link against Scala 2 artifacts (Scala 2.12 and upwards). |
| 56 | + - Scala 3 and Scala 2 share the same standard library. |
| 57 | + - With some small tweaks it is possible to cross-build code for both Scala 2 and 3. |
| 58 | + We will work on a guide defining the shared language subset that can be compiled under both versions. |
| 59 | + - The Scala 3 compiler has a `-language:Scala2` option that lets it compile most Scala 2 code |
| 60 | + and at the same time highlights necessary rewritings as migration warnings. |
| 61 | + - The compiler can perform many of the rewritings automatically using a `-rewrite` option. |
| 62 | + - Migration through automatic rewriting will also be offered through the `scalafix` tool, |
| 63 | + which does not require Scala 3 to be installed. |
| 64 | + |
| 65 | +_What’s the expected state of tool support?_ |
| 66 | + |
| 67 | + - Compiler: The Scala 3 compiler `dotc` has been used to compile itself and a growing set of libraries for a number of years now. |
| 68 | + - IDEs: IDE support is provided by having `dotc` implement LSP, the Language Server Protocol, |
| 69 | + including standard operations such as completion and hyperlinking and more advanced ones |
| 70 | + such as find references or rename. There’s a VS Code plugin incorporating these operations. |
| 71 | + Jetbrains has also released a first version of Dotty support in their Scala plugin, |
| 72 | + and we hope to work with them on further improvements. |
| 73 | + - REPL: A friendly REPL is supported by the compiler |
| 74 | + - Docs: A revamped ScalaDoc tool generates docs for viewing in a browser and (in the future) also in the IDE.. |
| 75 | + - Build tools: There is a Dotty/Scala 3 plugin for sbt, and we will also work on Scala 3 integration in other build tools. |
| 76 | + |
| 77 | +_What about stability?_ |
| 78 | + |
| 79 | + - A community build contains some initial open source projects that are compiled nightly using Scala 3. |
| 80 | + We plan to add a lot more projects to the build between now and the final release. |
| 81 | + - We plan to use the period of developer previews to ensure that core projects are published for Scala 3. |
| 82 | + - We have incorporated most of the Scala 2 regression tests in the Scala 3 test suite and will keep including new tests. |
| 83 | + - In the near future we plan to build all Scala 3 tools using a previous version of the `dotc` compiler itself. |
| 84 | + So far all tools are built first with the current Scala compiler and then again with `dotc`. |
| 85 | + Basing the build exclusively on Scala 3 has the advantage that it lets us “eat our own dog food” |
| 86 | + and try out the usability of Scala 3’s new language feature on a larger scale. |
| 87 | + |
| 88 | +_When can I try it out?_ |
| 89 | + |
| 90 | +You can start working with Dotty now. See the getting started |
| 91 | +guide. Dotty releases are published every 6 weeks. We expect to have |
| 92 | +developer previews for Scala 3.0 in the first half of 2019. |
| 93 | + |
| 94 | +_What about macros?_ |
| 95 | + |
| 96 | +Stay tuned! We are about to release another blog post specifically |
| 97 | +about that issue. |
| 98 | + |
| 99 | +_How can I help?_ |
| 100 | + |
| 101 | +Scala 3 is developed completely in the open at |
| 102 | +[https://github.com/lampepfl/dotty]. Get involved there, by fixing and |
| 103 | +opening issues, making pull requests, and participating in the |
| 104 | +discussions. |
0 commit comments