Skip to content

Instantly share code, notes, and snippets.

@SethTisue
Last active July 3, 2016 09:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SethTisue/79960134da77ec6f209d to your computer and use it in GitHub Desktop.
Save SethTisue/79960134da77ec6f209d to your computer and use it in GitHub Desktop.
Scalawags #38: The Sound of Dotty

Scalawags #38: The Sound of Dotty

YouTube link: https://www.youtube.com/watch?v=e687bFp2FT4

Our guest is Martin Odersky, the creator of Scala. We invited him on specifically to discuss Dotty, a new compiler for Scala.

Your hosts this episode: Josh Suereth, Dick Wall, Heather Miller, Seth Tisue

Join us during and between episodes for web-based Scalawags chat on Gitter.

Intro (0:00)

  • Martin's been blogging like a maniac, as he promised
  • Dick thinks Martin looks like the Milk Tray Man today, in his turtleneck

Milk Tray Martin

Where Dotty stands (1:50)

  • Dotty is an "advanced research experimental platform for future Scala"
  • in the works for about 3 years
  • coming soon, an initial alpha release for brave coders who like bugs and mystical error messages
  • Dotty is an open-source, volunteer project
    • open source contributors can talk to each other and the core team on Gitter
  • how's the SBT support? it works already, but whole-program only, no incremental compilation yet
  • Dmitry Petrashko is building an aggressive whole-program optimizer that uses TASTy
  • what's TASTy? typed abstract syntax trees, a high-level intermediate format, the serialized output of the type checker, before code generation
  • what programs has Dotty been tested on? "a handful". "most" of the Scala standard library, "all" of the collections, "a few" third-party projects
  • is there a REPL? yes, doti, but brand new and minimal

Community reaction to Dotty (10:00)

  • Martin's working on a new compiler instead of improving the old one, should we worry?
    • "You can't make everyone happy."
    • "Scala is due to have a big jump ahead."
  • the experimental-compiler approach has been working well for C#, with their experimental Roslyn compiler: more features, more excitement. "We can move so much faster"
  • Mads Torgersen: "We're stealing a lot of things from Scala, have you noticed?"
  • change in scalac "has slowed considerably", which is "just right for a lot of people" since "change is the opposite of stability"
  • perhaps Dotty will replace Scalac, or perhaps things will be backported to the old compiler

Type inference (12:40)

  • Josh: will we get fully spec'ed type inference in Dotty?
  • do other languages have this? Standard ML "might be the only one", "maybe OCaml"?
  • it's a worthy goal, but there's a danger of fossilization, too

Dotty, the blog posts (15:15)

  • the blog posts so far:
  • the blog posts are the essence, what's the essence of the essence?
  • the DOT calculus is a mini-language, like the lambda calculus, System J, et al
  • proving soundness for DOT was very hard, but now it's done
    • and the proof is verified with Coq
  • type projections were trouble area. that feature is "on its way out", to maintain soundness. instead, use implicits.
  • can Shapeless still be made to work? it will be need to be adapted, but yes, Miles thinks using implicits instead will work
  • Dick: how can Scala programmers prepare their code for Dotty?
    • number one is stay away from clever use of projections. many ordinary uses (e.g. to represent Java inner classes) will still be OK
    • all macros will need to be written, but the new version will be much simpler.
  • Josh: what about macros for serializing case classes?
    • Martin: we'll support scrap-your-boilerplate out of the box (but we don't yet), no macros needed

Scala goes multiplatform (27:05)

  • transition from JVM/.NET era design to JVM/JavaScript/LLVM era design, is this affecting Dotty decisions?
  • aside from macros avoiding reflection (already covered), just "tiny and reasonable" tweaks, e.g.:
    • synchronized will be moved off AnyRef and into a Monitor trait
    • small numerics changes (isInstanceOf/asInstanceOf) motivated by Scala.js
  • turning asInstanceOf checking off in Scala.js can give 30% or more speed improvement

Will Dotty replace scalac? (31:00)

  • (audience Q from Rajesh Pitty)
  • there are "no plans for that yet". if it happens it will be a major version bump, perhaps Scala 3
  • other languages are doing this, e.g. Swift 3 ("radically different from Swift 2"), Python 3. we'll have to see how fast the community will be willing to follow
  • how compatible is Dotty with Scala 2?
    • there is a switch to enable Scala 2 compatibility, and the hope is to help users with an automatic code rewriting tool (which doesn't exist yet, hey community want to take it on?)
    • if one manual intervention per thousand lines ends up being required, that seems reasonable
  • Dick describes his experience moving to Python 3
    • 1 line in 100 needing manual updating wasn't horrible

Will there be a Scala VM? (36:20)

  • (another audience Q from Rajesh Pitty)
  • "definitely not", it's "too big a project", but TASTy has some of the same advantages by providing a back-end-agnostic platform
  • Dick's dog Dottie corrects Martin's spelling

How can we help? (38:15)

  • Heather: how can people help with Dotty? is there low-hanging fruit?
  • Martin:
    • JLine integration in the REPL
    • the Dotty issue tracker actually has a low-hanging fruit tag
    • other REPL stuff in general
    • adding more sanity checks to the compiler
  • user question from Pedro Furlanetto: where to start with reading about Dotty?
    • Martin: there's no language spec yet, it's in our heads, but look at closed issues in the Dotty issue tracker
  • current main focus is compatibility with current Scala, so many planned new features aren't implemented yet
  • Seth suggests: start trying to get cornerstone third-party projects like ScalaCheck, ScalaTest, and Specs2 to build, with an eye towards eventually getting a minimal community build up

Google Summer of Code (43:25)

Conclusion (45:40)

  • so long!

Seth
Heather
Josh
Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment