|
| 1 | +--- |
| 2 | +layout: blog-page |
| 3 | +title: Announcing Dotty 0.25.0-RC2 - speed-up of givens, progress on Scala 2 macro compat |
| 4 | +author: Anatolii Kmetiuk |
| 5 | +authorImg: /images/anatolii.png |
| 6 | +date: 2020-06-16 |
| 7 | +--- |
| 8 | + |
| 9 | +Hello! We are excited to announce 0.25.0-RC2 of Dotty. In this version, following feedback of the community, we have improved compilation speeds when programming with givens. We have also made progress towards better cross-compilation of macro definitions between Scala 2 and Scala 3. |
| 10 | + |
| 11 | +You can try out this version right now, from the comfort of your SBT, by visiting the [home page](https://dotty.epfl.ch/) and scrolling down to the "Create a Dotty Project" section. |
| 12 | + |
| 13 | +Alternatively, you can try this version of Scala online via [Scastie](https://scastie.scala-lang.org/). Once you're there, click "Build Settings" and set "Target" to "Dotty". |
| 14 | + |
| 15 | +Enjoy the ride🚀! |
| 16 | + |
| 17 | +<!--more--> |
| 18 | +# Progress on macro compatibility with Scala 2 |
| 19 | +One of the most challenging parts of the migration from Scala 2 to Scala 3 are macros. Scala 3 has re-implementing the entire metaprogramming mechanism from scratch, and so all the Scala 2 macros must also be rewritten from scratch using the Scala 3 metaprogramming capabilities. |
| 20 | + |
| 21 | +Under these conditions, cross-compilation of a library between Scala 2 and Scala 3 also becomes more challenging since you need to split your sources between the two versions. |
| 22 | + |
| 23 | +To address this challenge, we are currently working on a solution to allow macro definitions of Scala 2 and Scala 3 macros to reside in the same file. This co-habitation will look as follows: |
| 24 | + |
| 25 | +```scala |
| 26 | +object Macro1 { |
| 27 | + import scala.language.experimental.macros |
| 28 | + def lineNumber: Int = macro LineNumberMacroScala2.thisLineNumberImpl |
| 29 | + inline def lineNumber: Int = ${ LineNumberMacroScala3.thisLineNumberExpr } |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +Currently, this is a work in progress. You can dive deeper into the current state of things by looking at PR [#8811](https://github.com/lampepfl/dotty/pull/8811). |
| 34 | + |
| 35 | +# Speed up the compiler when programming with givens |
| 36 | +Dotty brings to the user an enhanced error reporting when it comes to programming with givens. This better error reporting, however, proved to be a trade-off. Sometimes it takes an unreasonable amount of time and space to compute a quality suggestion to the end user. |
| 37 | + |
| 38 | +A number of users reported considerable slowdowns when it comes to programming with implicits. To address this issue, we have modified the logic for given imports suggestion. We introduced a per-run budget of 10 seconds, so it is guaranteed that it won't take longer than that time to compute all the given imports. |
| 39 | + |
| 40 | +This default budget is configurable via a compiler flag `-Ximport-suggestion-timeout`. |
| 41 | + |
| 42 | +This change should speed-up the compiler when it comes to programming with givens. |
| 43 | + |
| 44 | +For more information, see PR [#9167](https://github.com/lampepfl/dotty/pull/9167). |
| 45 | + |
| 46 | +# Let us know what you think! |
| 47 | + |
| 48 | +If you have questions or any sort of feedback, feel free to send us a message on our |
| 49 | +[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please |
| 50 | +[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). |
| 51 | + |
| 52 | +## Contributing |
| 53 | + |
| 54 | +TODO |
| 55 | + |
| 56 | +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! |
| 57 | +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), |
| 58 | +and have a look at some of the [good first issues](https://github.com/lampepfl/dotty/issues?q=is%3Aissue+is%3Aopen+label%3Aexp%3Anovice). |
| 59 | +They make perfect entry points into hacking on the compiler. |
| 60 | + |
| 61 | +We are looking forward to having you join the team of contributors. |
| 62 | + |
| 63 | +## Library authors: Join our community build |
| 64 | + |
| 65 | +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty |
| 66 | +snapshot. Currently, this includes shapeless, ScalaPB, algebra, scalatest, scopt and squants. |
| 67 | +Join our [community build](https://github.com/lampepfl/dotty/tree/master/community-build) |
| 68 | +to make sure that our regression suite includes your library. |
| 69 | + |
| 70 | +[Scastie]: https://scastie.scala-lang.org/?target=dotty |
| 71 | + |
| 72 | +[@odersky]: https://github.com/odersky |
| 73 | +[@DarkDimius]: https://github.com/DarkDimius |
| 74 | +[@smarter]: https://github.com/smarter |
| 75 | +[@felixmulder]: https://github.com/felixmulder |
| 76 | +[@nicolasstucki]: https://github.com/nicolasstucki |
| 77 | +[@liufengyun]: https://github.com/liufengyun |
| 78 | +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain |
| 79 | +[@biboudis]: https://github.com/biboudis |
| 80 | +[@allanrenucci]: https://github.com/allanrenucci |
| 81 | +[@Blaisorblade]: https://github.com/Blaisorblade |
| 82 | +[@Duhemm]: https://github.com/Duhemm |
| 83 | +[@AleksanderBG]: https://github.com/AleksanderBG |
| 84 | +[@milessabin]: https://github.com/milessabin |
| 85 | +[@anatoliykmetyuk]: https://github.com/anatoliykmetyuk |
0 commit comments