|
| 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-28 |
| 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 `println(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 | +TODO From changelog |
| 90 | + |
| 91 | +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! |
| 92 | +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), |
| 93 | +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). |
| 94 | +They make perfect entry points into hacking on the compiler. |
| 95 | + |
| 96 | +We are looking forward to having you join the team of contributors. |
| 97 | + |
| 98 | +## Library authors: Join our community build |
| 99 | + |
| 100 | +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty |
| 101 | +snapshot. Currently, this includes ScalaPB, algebra, scalatest, scopt and squants. |
| 102 | +Join our [community build](https://github.com/lampepfl/dotty-community-build) |
| 103 | +to make sure that our regression suite includes your library. |
| 104 | + |
| 105 | +[Scastie]: https://scastie.scala-lang.org/?target=dotty |
| 106 | + |
| 107 | +[@odersky]: https://github.com/odersky |
| 108 | +[@DarkDimius]: https://github.com/DarkDimius |
| 109 | +[@smarter]: https://github.com/smarter |
| 110 | +[@felixmulder]: https://github.com/felixmulder |
| 111 | +[@nicolasstucki]: https://github.com/nicolasstucki |
| 112 | +[@liufengyun]: https://github.com/liufengyun |
| 113 | +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain |
| 114 | +[@biboudis]: https://github.com/biboudis |
| 115 | +[@allanrenucci]: https://github.com/allanrenucci |
| 116 | +[@Blaisorblade]: https://github.com/Blaisorblade |
| 117 | +[@Duhemm]: https://github.com/Duhemm |
| 118 | +[@AleksanderBG]: https://github.com/AleksanderBG |
| 119 | +[@milessabin]: https://github.com/milessabin |
| 120 | +[@anatoliykmetyuk]: https://github.com/anatoliykmetyuk |
0 commit comments