Scala 3 arrives in 2020: How can you prepare for the big update?

Share
  • January 16, 2020

What does the road for Scala look like? 2020 will be a big year for the language. While there is no definitive date yet, Scala 3 will arrive sometime towards the end of this year. For a sneak peek of what it will include, turn your attention towards Dotty, a compiler that will eventually become Scala 3.0.

In December of 2019, Scala published a blog post revealing the roadmap ahead.

Take a page from the Scout’s motto and be prepared.

Scala 3 is on its way

The good news is that Scala 3 will be ready for production earlier than expected.

According to the updated roadmap, instead of releasing Scala 2.14 as a transitory version, the team has decided to simply skip 2.14 altogether and head directly to Scala 3.0. This also means that the library and tooling ecosystem will not require a time-consuming rebuild.

SEE ALSO: Red Hat & IBM stand by Google in Supreme Court case against Oracle

Previewing Dotty

Work on Dotty has been steady over the years, and with the latest release candidate 0.21.0-RC1, it is now officially feature complete. 🎉

Future additions to Dotty will include bug fixes, quality assurance, performance engineering, and improved documentation in preparation for its release as Scala 3.0.

You can test it out in your project by following the getting started guide, or even try out some examples in your browser with the Scatsie interactive playground. It comes with built-in IDE support for Visual Studio Code.

According to the documentation, Dotty’s main objectives are to:

  • become more opinionated by promoting programming idioms we found to work well,
  • simplify where possible,
  • eliminate inconsistencies and surprising behaviors,
  • build on strong foundations to ensure the design hangs well together,
  • consolidate language constructs to improve the language’s consistency, safety, ergonomics, and performance.

View Dotty’s documentation for the full scoop.

SEE ALSO: Java devs rate microservice satisfaction 6 stars out of 10

Breaking changes

One of the biggest breaking changes between the versions are macro methods. Macro methods from Scala v2.13 libraries will not be able to be used in Scala 3, which includes a different, newer macro system. Because of this, macro definitions will require a rewrite.

Besides this, Scala 3 drops a few language constructs. (DelayedInit, existential types, procedure syntax, class shadowing, XML literals, symbol literals, auto application, weak conformance, compound types, and auto tupling) According to the Dotty documentation, dropped features will require rewrites. Thankfully, some rewrites will be automatic, but some will require a manual rewrite.

Structural types, name-based pattern matching, eta expansion, and implicit resolution undergo some changes in Scala 3. These constructs will now be more regular.

Libraries compiled with Scala 3 will also include TASTy, Typed Abstract Syntax Trees (y). TASTy ensures that code using the Scala 3 library will work in newer editions of 3.x.

Beginning the migration

Since Scala 2.13 and Scala 3.0 will use share a standard library and have the same binary jar, migration will be smoother than say, migrating from Python 2 to 3.

From the roadmap:

The biggest thing Scala 3 needs from the community is for everyone to begin porting their code. For established projects, the logical first step would be to start cross-building against the latest Scala 3 milestone, when they become available (or use a Dotty milestone right now!). We expect this to be a common scenario during the transition period. Or, you can jump straight in and upgrade your code to Scala 3 and try out some of the new features!

Read about migrating the ecosystem for more information and begin your preparations.

The post Scala 3 arrives in 2020: How can you prepare for the big update? appeared first on JAXenter.

Source : JAXenter