|
| 1 | +--- |
| 2 | +layout: blog-page |
| 3 | +title: Announcing Dotty 0.12.0-RC1 |
| 4 | +author: Aggelos Biboudis |
| 5 | +authorImg: /images/aggelos.jpg |
| 6 | +date: 2019-01-21 |
| 7 | +--- |
| 8 | + |
| 9 | +Happy New Year to all with the first release of Dotty for 2019! ✨🎊🎉 |
| 10 | + |
| 11 | +Today we are excited to release the version 0.12.0-RC1 of the Dotty compiler. |
| 12 | +This release serves as a technology preview that demonstrates new language features and the |
| 13 | +compiler supporting them. |
| 14 | + |
| 15 | +Dotty is the project name for technologies that are considered for inclusion in Scala 3. Scala has |
| 16 | +pioneered the fusion of object-oriented and functional programming in a typed setting. Scala 3 will |
| 17 | +be a big step towards 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 well together, |
| 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 12th 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.12.0-RC1 technology preview? |
| 34 | + |
| 35 | +### Extension Methods |
| 36 | + |
| 37 | +We are excited to announce that extension methods are now offered through dedicated language support! |
| 38 | +Extension methods allow one to add methods to a type after the type is defined and up until now they were encoded through the powerful mechanism of implicits. |
| 39 | +Previously, one had to place the desired method in the trait with the receiver object to extend, as part of the parameter list. |
| 40 | +The infix-ness of the method was being restored by manually writing the implicit class, resolving `implicitly` that extended object. |
| 41 | + |
| 42 | +Now, in Dotty we can express an extension method by writing the method and prepending its name with the type to be extended. |
| 43 | + |
| 44 | +```scala |
| 45 | +case class Circle(x: Double, y: Double, radius: Double) |
| 46 | + |
| 47 | +def (c: Circle) circumference: Double = c.radius * math.Pi * 2 |
| 48 | +``` |
| 49 | + |
| 50 | +Read the [relevant documentation](https://dotty.epfl.ch/docs/reference/other-new-features/extension-methods.html) about generic extension methods, higher-kinded extension methods and more. |
| 51 | + |
| 52 | +### TASTy Reflect goodies |
| 53 | + |
| 54 | +We implement a new decompiler for TASTy files and we also offer a new VS Code Extension. |
| 55 | +The decompiler allows to view both decompiled scala source code and the pretty printed TASTy tree when opening a .tasty file. |
| 56 | +The feature is similar to opening .class files in IntelliJ. |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +The decompiler can be invoked with the corresponding flag: `dotc -decompile xyz.tasty`. |
| 61 | + |
| 62 | +On the programmatic side of TASTy we are rolling out changes according to our plan discussed at [Macros: The Plan for Scala 3](https://www.scala-lang.org/blog/2018/04/30/in-a-nutshell.html). |
| 63 | +In this release, we make progress following the _Next Steps_ of the aforementioned blogpost by offering constructors that work directly with reflect trees. |
| 64 | +Consequently, TASTy extractors meet their dual, TASTy constructors! |
| 65 | +We also connect the new lower-level reflection layer to the existing principled macro system based on quotes and splices offering, two new expression methods for `Expr[T]`: |
| 66 | + |
| 67 | +- `unseal` that unseals an `Expr[T]` (non traversable code) into a `Term` and |
| 68 | +- `seal` that seals back a `Term` into an `Expr[T]`. |
| 69 | + |
| 70 | +Read the [relevant documentation](https://dotty.epfl.ch/docs/reference/other-new-features/tasty-reflect.html) to learn how to go from quotes and splices to TASTys Reflect trees and back . |
| 71 | + |
| 72 | +### Alignments with the Scala Improvement Process |
| 73 | + |
| 74 | +In this version we improve the implementation of by-name implicits making it compliant with the [By-name Implicits](https://docs.scala-lang.org/sips/byname-implicits.html) SIP and we implement the `ValueOf` operator which yields the unique value of types with a single inhabitant, effectively syncing it up with the [Literal-Based Singleton Types](https://docs.scala-lang.org/sips/42.type.html) SIP. |
| 75 | + |
| 76 | +### Improvements to GADT support |
| 77 | + |
| 78 | +In this release, we're also rolling out the first batch of improvements to GADT support - namely, variable unification. |
| 79 | +To keep it short, from knowing that `A <: B` and `B <: A`, we can now deduce that `A = B`, and from `A = B` and `B <: C` we deduce that `A <: C`. |
| 80 | +This kind of reasoning is necessary for many advanced GADT usages! |
| 81 | + |
| 82 | +### And much more! |
| 83 | + |
| 84 | +Please read our [release notes](https://github.com/lampepfl/dotty/releases/tag/0.12.0-RC1) |
| 85 | +for more details! |
| 86 | + |
| 87 | +## Trying out Dotty |
| 88 | + |
| 89 | +### sbt |
| 90 | + |
| 91 | +You can set up a new sbt project with Dotty as the compiler by running: |
| 92 | + |
| 93 | +```shell |
| 94 | +sbt new lampepfl/dotty.g8 |
| 95 | +``` |
| 96 | + |
| 97 | +For more details on using Dotty with sbt, see the |
| 98 | +[example project](https://github.com/lampepfl/dotty-example-project). |
| 99 | + |
| 100 | +### [Mill](http://www.lihaoyi.com/mill/) |
| 101 | + |
| 102 | +The Mill build tool version 0.2.6 introduced experimental support for Dotty. For more details on |
| 103 | +using Dotty with Mill, see the |
| 104 | +[example project](https://github.com/lampepfl/dotty-example-project/tree/mill). |
| 105 | + |
| 106 | +### IDE support |
| 107 | + |
| 108 | +Start using the Dotty IDE in any Dotty project by following |
| 109 | +the [IDE guide](https://dotty.epfl.ch/docs/usage/ide-support.html). |
| 110 | + |
| 111 | +### Standalone installation |
| 112 | + |
| 113 | +Releases are available for download on the _Releases_ |
| 114 | +section of the Dotty repository: |
| 115 | +[https://github.com/lampepfl/dotty/releases](https://github.com/lampepfl/dotty/releases) |
| 116 | + |
| 117 | +For MacOs users, we also provide a [homebrew](https://brew.sh/) package that can be installed by |
| 118 | +running: |
| 119 | + |
| 120 | +```shell |
| 121 | +brew install lampepfl/brew/dotty |
| 122 | +``` |
| 123 | + |
| 124 | +In case you have already installed Dotty via `brew`, you should instead update it: |
| 125 | + |
| 126 | +```shell |
| 127 | +brew upgrade dotty |
| 128 | +``` |
| 129 | + |
| 130 | +## Let us know what you think! |
| 131 | + |
| 132 | +If you have questions or any sort of feedback, feel free to send us a message on our |
| 133 | +[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please |
| 134 | +[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). |
| 135 | + |
| 136 | +## Contributing |
| 137 | + |
| 138 | +Thank you to all the contributors who made this release possible! |
| 139 | + |
| 140 | +According to `git shortlog -sn --no-merges 0.11.0-RC1..0.12.0-RC1` these are: |
| 141 | + |
| 142 | +``` |
| 143 | + 109 Martin Odersky |
| 144 | + 64 Nicolas Stucki |
| 145 | + 34 Martin Duhem |
| 146 | + 25 Allan Renucci |
| 147 | + 16 Guillaume Martres |
| 148 | + 12 Aleksander Boruch-Gruszecki |
| 149 | + 11 Tobias Bordenca |
| 150 | + 10 Miles Sabin |
| 151 | + 10 Liu Fengyun |
| 152 | + 7 Aggelos Biboudis |
| 153 | + 7 Jaemin Hong |
| 154 | + 5 Paolo G. Giarrusso |
| 155 | + 3 duanebester |
| 156 | + 3 Dotty CI |
| 157 | + 2 Sébastien Doeraene |
| 158 | + 2 Saurabh Rawat |
| 159 | + 2 Vlastimil Dort |
| 160 | + 1 tOverney |
| 161 | + 1 Denis Buzdalov |
| 162 | + 1 Hermes Espínola González |
| 163 | + 1 Ivan Youroff |
| 164 | + 1 João Pedro de Carvalho |
| 165 | + 1 Neeraj Jaiswal |
| 166 | + 1 Olivier Blanvillain |
| 167 | + 1 poechsel |
| 168 | + 1 Abel Nieto |
| 169 | +``` |
| 170 | + |
| 171 | +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! |
| 172 | +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), |
| 173 | +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). |
| 174 | +They make perfect entry points into hacking on the compiler. |
| 175 | + |
| 176 | +We are looking forward to having you join the team of contributors. |
| 177 | + |
| 178 | +## Library authors: Join our community build |
| 179 | + |
| 180 | +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty |
| 181 | +snapshot. Currently this includes ScalaPB, algebra, scalatest, scopt and squants. |
| 182 | +Join our [community build](https://github.com/lampepfl/dotty-community-build) |
| 183 | +to make sure that our regression suite includes your library. |
| 184 | + |
| 185 | +[Scastie]: https://scastie.scala-lang.org/?target=dotty |
| 186 | + |
| 187 | +[@odersky]: https://github.com/odersky |
| 188 | +[@DarkDimius]: https://github.com/DarkDimius |
| 189 | +[@smarter]: https://github.com/smarter |
| 190 | +[@felixmulder]: https://github.com/felixmulder |
| 191 | +[@nicolasstucki]: https://github.com/nicolasstucki |
| 192 | +[@liufengyun]: https://github.com/liufengyun |
| 193 | +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain |
| 194 | +[@biboudis]: https://github.com/biboudis |
| 195 | +[@allanrenucci]: https://github.com/allanrenucci |
| 196 | +[@Blaisorblade]: https://github.com/Blaisorblade |
| 197 | +[@Duhemm]: https://github.com/Duhemm |
| 198 | +[@AleksanderBG]: https://github.com/AleksanderBG |
| 199 | +[@milessabin]: https://github.com/milessabin |
0 commit comments