A Center for Sustainable Cloud Computing

Sustainable Data Centers

Scala: Dotty

A next-generation compiler for Scala

Dotty is the project name for technologies that are considered for inclusion in Scala 3. Scala has pioneered the fusion of object-oriented and functional programming in a typed setting. Scala 3 will be a big step towards realizing the full potential of these ideas.

Its 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.

Dotty implements many language changes compared to Scala 2. These changes are currently discussed for inclusion in Scala 3, the new Scala language standard which will be based on the Dotty codebase.

The language redesign was guided by three main goals:

  • Strengthen Scala’s foundations. Make the full programming language compatible with the foundational work on the DOT calculus and apply the lessons learned from that work.
  • Make Scala easier and safer to use. Tame powerful constructs such as implicits to provide a gentler learning curve. Remove warts and puzzlers.
  • Further improve the consistency and expressiveness of Scala’s language constructs.

New constructs directly model core features of DOT, higher-kinded types, and the SI calculus for implicit resolution.

Another set of new constructs replace existing constructs with the aim of making the language safer and simpler to use, and to promote uniformity in code style. With the exception of early initializers and old-style vararg patterns, all superseded constructs continue to be available in Scala 3.0. The plan is to deprecate and phase them out later.

Several constructs are restricted to make the language safer. Unrestricted implicit conversions continue to be available in Scala 3.0, but will be deprecated and removed later. Unrestricted versions of the other constructs in the list above are available only under -source 3.0-migration.

Many constructs are proposed to be dropped without a new construct replacing them. The motivation for dropping these constructs is to simplify the language and its implementation.

Some other constructs have undergone changes to make them more regular and useful. There are also additions to the language that make it more powerful or pleasant to use.

For more details, visit https://dotty.epfl.ch/