|
| 1 | +--- |
| 2 | +layout: blog-page |
| 3 | +title: Announcing Dotty 0.15.0-RC1 with TODO |
| 4 | +author: Anatolii Kmetiuk |
| 5 | +authorImg: /images/anatolii.png |
| 6 | +date: 2019-05-24 |
| 7 | +--- |
| 8 | + |
| 9 | +Hi! In this article, we'd like to announce the 15th release of Dotty. With this release comes a bunch of improvements |
| 10 | + |
| 11 | +This release serves as a technology preview that demonstrates new |
| 12 | +language features and the compiler supporting them. |
| 13 | + |
| 14 | +Dotty is the project name for technologies that are being considered for |
| 15 | +inclusion in Scala 3. Scala has pioneered the fusion of object-oriented and |
| 16 | +functional programming in a typed setting. Scala 3 will be a big step towards |
| 17 | +realising the full potential of these ideas. Its main objectives are to |
| 18 | + |
| 19 | +- become more opinionated by promoting programming idioms we found to work well, |
| 20 | +- simplify where possible, |
| 21 | +- eliminate inconsistencies and surprising behaviours, |
| 22 | +- build on strong foundations to ensure the design hangs together well, |
| 23 | +- consolidate language constructs to improve the language’s consistency, safety, ergonomics, and |
| 24 | + performance. |
| 25 | + |
| 26 | +You can learn more about Dotty on our [website](https://dotty.epfl.ch). |
| 27 | + |
| 28 | +<!--more--> |
| 29 | + |
| 30 | +This is our 14th scheduled release according to our |
| 31 | +[6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). |
| 32 | + |
| 33 | +# What’s new in the 0.15.0-RC1 technology preview? |
| 34 | +## Operator Rules |
| 35 | +This change addresses the problem of the regulation of whether an operator is supposed to be used in an infix position. The motivation is for the library authors to be able to enforce whether a method or a type is supposed to be used in an infix position by the users. |
| 36 | + |
| 37 | +Methods with symbolic names like `+` are allowed to be used in an infix position by default: |
| 38 | + |
| 39 | +```scala |
| 40 | +scala> case class Foo(x: Int) { def +(other: Foo) = x + other.x } |
| 41 | +// defined case class Foo |
| 42 | + |
| 43 | +scala> Foo(1) + Foo(2) |
| 44 | +val res0: Int = 3 |
| 45 | +``` |
| 46 | + |
| 47 | +Methods with alphanumeric names are not allowed to be used in an infix position by default. Breaking this constraint will raise a deprecation warning: |
| 48 | + |
| 49 | +```scala |
| 50 | +scala> case class Foo(x: Int) { def plus(other: Foo) = x + other.x } |
| 51 | +// defined case class Foo |
| 52 | + |
| 53 | +scala> Foo(1) plus Foo(2) |
| 54 | +1 |Foo(1) plus Foo(2) |
| 55 | + | ^^^^ |
| 56 | + |Alphanumeric method plus is not declared @infix; it should not be used as infix operator. |
| 57 | + |The operation can be rewritten automatically to `plus` under -deprecation -rewrite. |
| 58 | + |Or rewrite to method syntax .plus(...) manually. |
| 59 | +val res1: Int = 3 |
| 60 | + |
| 61 | +scala> Foo(1).plus(Foo(2)) |
| 62 | +val res2: Int = 3 |
| 63 | +``` |
| 64 | + |
| 65 | +As the warning says, if you want the users of your library to be able to use it in an infix position, you can do so as follows: |
| 66 | + |
| 67 | +```scala |
| 68 | +scala> import scala.annotation.infix |
| 69 | + |
| 70 | +scala> case class Foo(x: Int) { @infix def plus(other: Foo) = x + other.x } |
| 71 | +// defined case class Foo |
| 72 | + |
| 73 | +scala> Foo(1) plus Foo(2) |
| 74 | +val res3: Int = 3 |
| 75 | +``` |
| 76 | + |
| 77 | +The above change will allow for more consistency across the code base, as the author of a method is able to make a decision on how the method is supposed to be called. |
| 78 | + |
| 79 | +To smoothen the migration, the deprecation warnings will only be emitted if you compile with the `-strict` flag under Dotty 3. Alphanumeric methods that are defined without the `@infix` annotation used in an infix position will be deprecated by default starting with Dotty 3.1. |
| 80 | + |
| 81 | +### Compatibility: the `@alpha` annotation |
| 82 | + |
| 83 | + |
| 84 | +## Other changes |
| 85 | + |
| 86 | +Some of the other changes include: |
| 87 | + |
| 88 | +- `infer` method renamed to `the`, the semantics of which is now the same as that of the `the` method of Shapeless. Namely, the implicits are resolved more precisely – see this [gist](https://gist.github.com/milessabin/8833a1dbf7e8245b30f8) for an example in Shapeless, and the Dotty [documentation](http://dotty.epfl.ch/docs/reference/contextual/inferable-params.html#querying-implied-instances) for more details. |
| 89 | +- The syntax of quoting and splicing was changed. Now the quoting is expressed via `'{ ... }` and `'[...]` and splicing – via `${...}` and `$id`. Please see the [documentation](http://dotty.epfl.ch/docs/reference/other-new-features/principled-meta-programming.html) for more details on these features. |
| 90 | + |
| 91 | +# Let us know what you think! |
| 92 | + |
| 93 | +If you have questions or any sort of feedback, feel free to send us a message on our |
| 94 | +[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please |
| 95 | +[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). |
| 96 | + |
| 97 | +## Contributing |
| 98 | + |
| 99 | +Thank you to all the contributors who made this release possible! |
| 100 | + |
| 101 | +According to `git shortlog -sn --no-merges 0.13.0-RC1..0.14.0-RC1` these are: |
| 102 | + |
| 103 | +``` |
| 104 | + 214 Martin Odersky |
| 105 | + 151 Nicolas Stucki |
| 106 | + 71 Liu Fengyun |
| 107 | + 53 Guillaume Martres |
| 108 | + 26 Olivier Blanvillain |
| 109 | + 10 Aleksander Boruch-Gruszecki |
| 110 | + 9 Aggelos Biboudis |
| 111 | + 6 Miles Sabin |
| 112 | + 4 Allan Renucci |
| 113 | + 4 Dale Wijnand |
| 114 | + 3 Anatolii Kmetiuk |
| 115 | + 2 Fengyun Liu |
| 116 | + 2 Alex Zolotko |
| 117 | + 1 gnp |
| 118 | + 1 tim-zh |
| 119 | + 1 Dmitry Petrashko |
| 120 | + 1 Dotty CI |
| 121 | + 1 Jasper Moeys |
| 122 | + 1 Jentsch |
| 123 | + 1 Jim Van Horn |
| 124 | + 1 Lionel Parreaux |
| 125 | + 1 Master-Killer |
| 126 | + 1 Olivier ROLAND |
| 127 | + 1 Robert Stoll |
| 128 | + 1 Seth Tisue |
| 129 | + 1 Tomasz Godzik |
| 130 | + 1 Victor |
| 131 | +``` |
| 132 | + |
| 133 | +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! |
| 134 | +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), |
| 135 | +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). |
| 136 | +They make perfect entry points into hacking on the compiler. |
| 137 | + |
| 138 | +We are looking forward to having you join the team of contributors. |
| 139 | + |
| 140 | +## Library authors: Join our community build |
| 141 | + |
| 142 | +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty |
| 143 | +snapshot. Currently this includes ScalaPB, algebra, scalatest, scopt and squants. |
| 144 | +Join our [community build](https://github.com/lampepfl/dotty-community-build) |
| 145 | +to make sure that our regression suite includes your library. |
| 146 | + |
| 147 | +[Scastie]: https://scastie.scala-lang.org/?target=dotty |
| 148 | + |
| 149 | +[@odersky]: https://github.com/odersky |
| 150 | +[@DarkDimius]: https://github.com/DarkDimius |
| 151 | +[@smarter]: https://github.com/smarter |
| 152 | +[@felixmulder]: https://github.com/felixmulder |
| 153 | +[@nicolasstucki]: https://github.com/nicolasstucki |
| 154 | +[@liufengyun]: https://github.com/liufengyun |
| 155 | +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain |
| 156 | +[@biboudis]: https://github.com/biboudis |
| 157 | +[@allanrenucci]: https://github.com/allanrenucci |
| 158 | +[@Blaisorblade]: https://github.com/Blaisorblade |
| 159 | +[@Duhemm]: https://github.com/Duhemm |
| 160 | +[@AleksanderBG]: https://github.com/AleksanderBG |
| 161 | +[@milessabin]: https://github.com/milessabin |
0 commit comments