|
| 1 | +--- |
| 2 | +layout: blog-page |
| 3 | +title: Announcing Dotty 0.24.0-RC1 - 2.13.2 standard library, better error messages and more |
| 4 | +author: Anatolii Kmetiuk |
| 5 | +authorImg: /images/anatolii.png |
| 6 | +date: 2020-04-29 |
| 7 | +--- |
| 8 | + |
| 9 | +Hello! We are excited to announce 0.24.0-RC1 of Dotty. In this version, we have updated the standard library to 2.13.2. Also, we have made some work to make error messages more user friendly and a bunch of other polishings to the language. |
| 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 | +# REPL works with indented code |
| 19 | +REPL now supports indented code. Consider the following snippet: |
| 20 | + |
| 21 | +```scala |
| 22 | +scala> if true then |
| 23 | + | print(1) |
| 24 | + | print(2) |
| 25 | + | |
| 26 | +``` |
| 27 | + |
| 28 | +Previously, the REPL would have stopped after `print(1)`. Now, it waits either for an `else` block or an extra newline to indicate the end of the expression. The above example will output `12` as expected. |
| 29 | + |
| 30 | +# Better error message for ifs that miss an else branch |
| 31 | +The error messages are now more beginner-friendly. Consider the following: |
| 32 | + |
| 33 | +```scala |
| 34 | +def f: Int = if ??? then 1 |
| 35 | +``` |
| 36 | + |
| 37 | +Above, the `if` expression returns a `Unit` since an `else` clause is missing. Previously, the user would have gotten the following error: |
| 38 | + |
| 39 | +``` |
| 40 | +-- [E007] Type Mismatch Error: ... |
| 41 | +12 |def f: Int = if ??? then 1 |
| 42 | + | ^^^^^^^^^^^^^ |
| 43 | + | Found: Unit |
| 44 | + | Required: Int |
| 45 | +``` |
| 46 | + |
| 47 | +Now, the above error message also contains the following sentence: |
| 48 | + |
| 49 | +``` |
| 50 | + | Maybe you are missing an else part for the conditional? |
| 51 | +``` |
| 52 | + |
| 53 | +We hope this change will make the language more intuitive for new users. |
| 54 | + |
| 55 | +# Inline overrides |
| 56 | +Inline overrides are now supported. For example, consider the following code: |
| 57 | + |
| 58 | +```scala |
| 59 | +abstract class A: |
| 60 | + def f(x: Int) = s"Foo $x" |
| 61 | + |
| 62 | +class B extends A: |
| 63 | + inline override def f(x: Int) = s"Bar $x" |
| 64 | + |
| 65 | +@main def Test = |
| 66 | + val b = B() |
| 67 | + println(b.f(22)) |
| 68 | + val a: A = b |
| 69 | + println(a.f(22)) |
| 70 | +``` |
| 71 | + |
| 72 | +The output of the above program is: |
| 73 | + |
| 74 | +``` |
| 75 | +Bar 22 |
| 76 | +Bar 22 |
| 77 | +``` |
| 78 | + |
| 79 | +This new change, however, comes with rather intricated rules – if you are interested to learn about them in details, see [documentation](https://dotty.epfl.ch/docs/reference/metaprogramming/inline.html#rules-for-overriding) on inlines and the PR #[8543](https://github.com/lampepfl/dotty/pull/8543/files) which introduced the change. |
| 80 | + |
| 81 | +# Let us know what you think! |
| 82 | + |
| 83 | +If you have questions or any sort of feedback, feel free to send us a message on our |
| 84 | +[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please |
| 85 | +[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). |
| 86 | + |
| 87 | +## Contributing |
| 88 | + |
| 89 | +Thank you to all the contributors who made this release possible 🎉 |
| 90 | + |
| 91 | +According to `git shortlog -sn --no-merges 0.23.0-RC1..0.24.0-RC1` these are: |
| 92 | + |
| 93 | +``` |
| 94 | + 136 Martin Odersky |
| 95 | + 74 Nicolas Stucki |
| 96 | + 37 Guillaume Martres |
| 97 | + 33 Robert Stoll |
| 98 | + 22 Liu Fengyun |
| 99 | + 19 Anatolii Kmetiuk |
| 100 | + 16 Arnaud ESTEVE |
| 101 | + 15 Olivier Blanvillain |
| 102 | + 10 Arnaud Esteve |
| 103 | + 9 Martijn Hoekstra |
| 104 | + 6 Anatolii |
| 105 | + 4 Som Snytt |
| 106 | + 4 bishabosha |
| 107 | + 4 Aleksander Boruch-Gruszecki |
| 108 | + 3 Miles Sabin |
| 109 | + 2 odersky |
| 110 | + 2 Fengyun Liu |
| 111 | + 2 Julien Richard-Foy |
| 112 | + 1 Ara Adkins |
| 113 | + 1 Maxime Kjaer |
| 114 | + 1 Philippus |
| 115 | + 1 Rike-Benjamin Schuppner |
| 116 | + 1 Julien Jean Paul Sirocchi |
| 117 | + 1 Dani Rey |
| 118 | + 1 Sébastien Doeraene |
| 119 | + 1 aesteve |
| 120 | + 1 Dale Wijnand |
| 121 | + 1 fhackett |
| 122 | + 1 gzoller |
| 123 | + 1 Michael Pilquist |
| 124 | +``` |
| 125 | + |
| 126 | +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! |
| 127 | +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), |
| 128 | +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). |
| 129 | +They make perfect entry points into hacking on the compiler. |
| 130 | + |
| 131 | +We are looking forward to having you join the team of contributors. |
| 132 | + |
| 133 | +## Library authors: Join our community build |
| 134 | + |
| 135 | +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty |
| 136 | +snapshot. Currently, this includes shapeless, ScalaPB, algebra, scalatest, scopt and squants. |
| 137 | +Join our [community build](https://github.com/lampepfl/dotty/tree/master/community-build) |
| 138 | +to make sure that our regression suite includes your library. |
| 139 | + |
| 140 | +[Scastie]: https://scastie.scala-lang.org/?target=dotty |
| 141 | + |
| 142 | +[@odersky]: https://github.com/odersky |
| 143 | +[@DarkDimius]: https://github.com/DarkDimius |
| 144 | +[@smarter]: https://github.com/smarter |
| 145 | +[@felixmulder]: https://github.com/felixmulder |
| 146 | +[@nicolasstucki]: https://github.com/nicolasstucki |
| 147 | +[@liufengyun]: https://github.com/liufengyun |
| 148 | +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain |
| 149 | +[@biboudis]: https://github.com/biboudis |
| 150 | +[@allanrenucci]: https://github.com/allanrenucci |
| 151 | +[@Blaisorblade]: https://github.com/Blaisorblade |
| 152 | +[@Duhemm]: https://github.com/Duhemm |
| 153 | +[@AleksanderBG]: https://github.com/AleksanderBG |
| 154 | +[@milessabin]: https://github.com/milessabin |
| 155 | +[@anatoliykmetyuk]: https://github.com/anatoliykmetyuk |
0 commit comments