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