image

Dotty

A next generation compiler for Scala

expand_more

Why Dotty?

Dotty is a platform to try out new language concepts and compiler technologies for Scala. The focus is mainly on simplification. We remove extraneous syntax (e.g. no XML literals), and try to boil down Scala’s types into a smaller set of more fundamental constructors. The theory behind these constructors is researched in DOT, a calculus for dependent object types.

Is it the future Scala?

Yes, it will be - eventually.

Can I use it?

You can! But it currently comes with no guarantees of stability.

Is there Scala 2 interop?

Dotty currently interops with libraries compiled with Scala 2.11 - but not 2.12

How do I migrate my code to Dotty?

An automated rewriting tool is planned for Dotty, more on this to come. Scala 2 sources can be compiled to some degree by issuing:

./bin/dotc -language:Scala2 file.scala

when compiling your program.

Who’s working on it?

Martin Odersky
Dmitry Petrashko
Guillaume Martres
Liu Fengyun
Felix Mulder

And a long line of contributors!

So, features?

Union, intersection and literal singleton types Implemented
Fast compilation (phase fusion) Implemented
Trait parameters Implemented
@static methods and fields Implemented
Improved REPL with colors Implemented
Sbt incremental build Implemented
Non-blocking lazy vals Implemented
Option-less pattern matching (based on name-based patmat) Implemented
Function arity adaptation Implemented
Multiversal equality Implemented
Non-boxed arrays of value classes In progress
Working contravariant implicits In progress
Auto-Specialization In progress
Whole program optimizer In progress
HList & HMaps/Record types Considered
Implicit functions Considered
Effects Considered
Auto-completion in repl Considered
Spec Option-less pattern matching Considered
Exhaustivity checks in pattern matching Considered

The complete list is available here.

Talks on Dotty?

I have more questions!

That’s great! We have more details on the Github Wiki and please join our Gitter channel!

Getting Started

Using Dotty to compile your project is now pretty simple. Create the following structure:

.
├── build.sbt
├── project
│   ├── build.properties
│   └── plugins.sbt
└── src

build.sbt

name := "application"
version := "0.1"
enablePlugins(DottyPlugin)

build.properties

sbt.version=0.13.11

plugins.sbt

addSbtPlugin("com.felixmulder" % "sbt-dotty" % "0.1.1")

This plugin is based on the dotty-example-project, but let’s you skip building dotty from scratch.