|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +post-type: blog |
| 4 | +by: Martin Odersky and Dmitry Petrashko |
| 5 | +title: We Got LiftOff! The Dotty Compiler for Scala Bootstraps. |
| 6 | +--- |
| 7 | + |
| 8 | +## We Got Liftoff! |
| 9 | + |
| 10 | +The [Dotty project](https://github.com/lampepfl/dotty) |
| 11 | +is a platform to develop new technology for Scala |
| 12 | +tooling and to try out concepts of future Scala language versions. |
| 13 | +Its compiler is a new design intended to reflect the |
| 14 | +lessons we learned from work with the Scala compiler. A clean redesign |
| 15 | +today will let us iterate faster with new ideas in the future. |
| 16 | + |
| 17 | +Today we reached an important milestone: The Dotty compiler can |
| 18 | +compile itself, and the compiled compiler can act as a drop-in for the |
| 19 | +original one. This is what one calls a *bootstrap*. |
| 20 | + |
| 21 | +## Why is this important? |
| 22 | + |
| 23 | +The main reason is that this gives us a some validation of the |
| 24 | +*trustworthiness* of the compiler itself. Compilers are complex beasts, |
| 25 | +and many things can go wrong. By far the worst things that can go |
| 26 | +wrong are bugs where incorrect code is produced. It's not fun debugging code that looks perfectly |
| 27 | +fine, yet gets translated to something subtly wrong by the compiler. |
| 28 | + |
| 29 | +Having the compiler compile itself is a good test to demonstrate that |
| 30 | +the generated code has reached a certain level of quality. Not only is |
| 31 | +a compiler a large program (44k lines in the case of dotty), it is |
| 32 | +also one that exercises a large part of the language in quite |
| 33 | +intricate ways. Moreover, bugs in the code of a compiler don't tend to |
| 34 | +go unnoticed, precisely because every part of a compiler feeds into |
| 35 | +other parts and all together are necessary to produce a correct |
| 36 | +translation. |
| 37 | + |
| 38 | +## Are We Done Yet? |
| 39 | + |
| 40 | +Far from it! The compiler is still very rough. A lot more work is |
| 41 | +needed to |
| 42 | + |
| 43 | + - make it more robust, in particular when analyzing incorrect programs, |
| 44 | + - improve error messages and warnings, |
| 45 | + - improve the efficiency of some of the generated code, |
| 46 | + - embed it in external tools such as sbt, REPL, IDEs, |
| 47 | + - remove restrictions on what Scala code can be compiled, |
| 48 | + - help in migrating Scala code that will have to be changed. |
| 49 | + |
| 50 | +## What Are the Next Steps? |
| 51 | + |
| 52 | +Over the coming weeks and months, we plan to work on the following topics: |
| 53 | + |
| 54 | + - Make snapshot releases. |
| 55 | + - Get the Scala standard library to compile. |
| 56 | + - Work on SBT integration of the compiler. |
| 57 | + - Work on IDE support. |
| 58 | + - Investigate the best way to obtaining a REPL. |
| 59 | + - Work on the build infrastructure. |
| 60 | + |
| 61 | +If you want to get your hands dirty with any of this, now is a good moment to get involved! |
| 62 | +To get started: <https://github.com/lampepfl/dotty>. |
| 63 | + |
0 commit comments