|
| 1 | +--- |
| 2 | +layout: blog-page |
| 3 | +title: Announcing Dotty 0.10.0-RC1 |
| 4 | +author: Allan Renucci |
| 5 | +authorImg: /images/allan.jpg |
| 6 | +date: 2018-10-10 |
| 7 | +--- |
| 8 | + |
| 9 | +After a long summer break, we are excited to release Dotty version 0.10.0-RC1. |
| 10 | +This release serves as a technology preview that demonstrates new language features and the |
| 11 | +compiler supporting them. |
| 12 | + |
| 13 | +Dotty is the project name for technologies that are considered for inclusion in Scala 3. Scala has |
| 14 | +pioneered the fusion of object-oriented and functional programming in a typed setting. Scala 3 will |
| 15 | +be a big step towards realising the full potential of these ideas. Its main objectives are to |
| 16 | + |
| 17 | +- become more opinionated by promoting programming idioms we found to work well, |
| 18 | +- simplify where possible, |
| 19 | +- eliminate inconsistencies and surprising behaviours, |
| 20 | +- build on strong foundations to ensure the design hangs well together, |
| 21 | +- consolidate language constructs to improve the language’s consistency, safety, ergonomics, and |
| 22 | + performance. |
| 23 | + |
| 24 | +You can learn more about Dotty on our [website](https://dotty.epfl.ch). |
| 25 | + |
| 26 | +<!--more--> |
| 27 | + |
| 28 | +This is our 10th scheduled release according to our |
| 29 | +[6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). |
| 30 | + |
| 31 | +## What’s new in the 0.10.0-RC1 technology preview? |
| 32 | + |
| 33 | +### Java 9+ |
| 34 | + |
| 35 | +Dotty now supports the latest versions of Java including Java 11! |
| 36 | + |
| 37 | +### Type-level programming: Match Types |
| 38 | + |
| 39 | +We've introduced a new form of types called match types. A match types is a mechanism for checking a |
| 40 | +type against a pattern. A match type reduces to one of a number of right hand sides, depending on a |
| 41 | +scrutinee type. E.g: |
| 42 | + |
| 43 | +```scala |
| 44 | +type Elem[X] = X match { |
| 45 | + case String => Char |
| 46 | + case Array[t] => t |
| 47 | + case Iterable[t] => t |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +This defines a type that, depending on the scrutinee type `X`, can reduce to one of its right hand |
| 52 | +sides. For instance, |
| 53 | + |
| 54 | +```scala |
| 55 | +Elem[String] =:= Char |
| 56 | +Elem[Array[Int]] =:= Int |
| 57 | +Elem[List[Float]] =:= Float |
| 58 | +Elem[Nil] =:= Nothing |
| 59 | +``` |
| 60 | + |
| 61 | +Here `=:=` is understood to mean that left and right hand sides are mutually subtypes of each other. |
| 62 | + |
| 63 | +This feature is still experimental and subject to changes. For more information, visit the |
| 64 | +[Match Types](http://dotty.epfl.ch/docs/reference/match-types.html) section of our documentation. |
| 65 | + |
| 66 | +### Documentation in the REPL |
| 67 | + |
| 68 | +The previous release added documentation support for the IDE. Users can now query the documentation |
| 69 | +of sources previously compiled with Dotty within the REPL: |
| 70 | + |
| 71 | +```scala |
| 72 | +scala> /** An object */ object O { /** A def */ def foo = 0 } |
| 73 | +// defined object O |
| 74 | + |
| 75 | +scala> :doc O |
| 76 | +/** An object */ |
| 77 | + |
| 78 | +scala> :doc O.foo |
| 79 | +/** A def */ |
| 80 | +``` |
| 81 | + |
| 82 | +### Tail-recursive methods can now be polymorphic |
| 83 | + |
| 84 | +Previously, a tail recursive call would be optimised only if the type arguments of the method |
| 85 | +or the enclosing class did not change at call site. E.g. |
| 86 | + |
| 87 | +```scala |
| 88 | +@tailrec def loop[T](x: T): Int = { |
| 89 | + ... |
| 90 | + loop[Int](1) |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +```shell |
| 95 | + loop[Int](1) |
| 96 | + ^^^^^^^^^^^^ |
| 97 | + Cannot rewrite recursive call: it changes type arguments on a polymorphic recursive call |
| 98 | +``` |
| 99 | + |
| 100 | +This restriction has now been removed. We also improve upon `scalac` which is not able to optimise |
| 101 | +methods that change the type of `this` on a polymorphic recursive call. |
| 102 | +[Examples](https://github.com/lampepfl/dotty/blob/7a45a4a386d33180e5b7b21aa74271a77cce4707/tests/neg-tailcall/tailrec.scala#L43-L44) |
| 103 | +can be found in our test suite. |
| 104 | + |
| 105 | +### Experimental support for generic Tuples |
| 106 | + |
| 107 | +We augmented the `Tuple` class with generic methods such as `head`, `tail`, `apply`, `*:` and `++`. |
| 108 | + |
| 109 | +```scala |
| 110 | +scala> val t0 = (1, "2", 3L) |
| 111 | +val t0: (Int, String, Long) = (1,2,3) |
| 112 | + |
| 113 | +scala> val head = t0.head |
| 114 | +val head: Int = 1 |
| 115 | + |
| 116 | +scala> val tail = t0.tail |
| 117 | +val tail: (String, Long) = (2,3) |
| 118 | + |
| 119 | +scala> val t1 = 0.0 *: t0 |
| 120 | +val t1: (Double, Int, String, Long) = (0.0,1,2,3) |
| 121 | + |
| 122 | +scala> val t2 = t0 ++ t0 |
| 123 | +val t2: (Int, String, Long, Int, String, Long) = (1,2,3,1,2,3) |
| 124 | +``` |
| 125 | + |
| 126 | +### And much more! |
| 127 | + |
| 128 | +Please read our [release notes](https://github.com/lampepfl/dotty/releases/tag/0.10.0-RC1) |
| 129 | +for more details! |
| 130 | + |
| 131 | +## Breaking changes |
| 132 | + |
| 133 | +Dotty 0.10.0-RC1 requires sbt-dotty 0.2.4 and sbt 1.2.3 or newer. |
| 134 | + |
| 135 | +## Trying out Dotty |
| 136 | + |
| 137 | +### sbt |
| 138 | + |
| 139 | +You can setup a new sbt project with Dotty as the compiler by running: |
| 140 | + |
| 141 | +```shell |
| 142 | +sbt new lampepfl/dotty.g8 |
| 143 | +``` |
| 144 | + |
| 145 | +For more details on using Dotty with sbt, see the |
| 146 | +[example project](https://github.com/lampepfl/dotty-example-project). |
| 147 | + |
| 148 | +### [Mill](http://www.lihaoyi.com/mill/) |
| 149 | + |
| 150 | +The Mill build tool version 0.2.6 introduced experimental support for Dotty. For more details on |
| 151 | +using Dotty with Mill, see the |
| 152 | +[example project](https://github.com/lampepfl/dotty-example-project/tree/mill). |
| 153 | + |
| 154 | +### IDE support |
| 155 | + |
| 156 | +Start using the Dotty IDE in any Dotty project by following |
| 157 | +the [IDE guide](https://dotty.epfl.ch/docs/usage/ide-support.html). |
| 158 | + |
| 159 | +### Standalone installation |
| 160 | + |
| 161 | +Releases are available for download on the _Releases_ |
| 162 | +section of the Dotty repository: |
| 163 | +[https://github.com/lampepfl/dotty/releases](https://github.com/lampepfl/dotty/releases) |
| 164 | + |
| 165 | +For MacOs users, we also provide a [homebrew](https://brew.sh/) package that can be installed by |
| 166 | +running: |
| 167 | + |
| 168 | +```shell |
| 169 | +brew install lampepfl/brew/dotty |
| 170 | +``` |
| 171 | + |
| 172 | +In case you have already installed Dotty via `brew`, you should instead update it: |
| 173 | + |
| 174 | +```shell |
| 175 | +brew upgrade dotty |
| 176 | +``` |
| 177 | + |
| 178 | +## Let us know what you think! |
| 179 | + |
| 180 | +If you have questions or any sort of feedback, feel free to send us a message on our |
| 181 | +[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please |
| 182 | +[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). |
| 183 | + |
| 184 | +## Contributing |
| 185 | + |
| 186 | +Thank you to all the contributors who made this release possible! |
| 187 | + |
| 188 | +According to `git shortlog -sn --no-merges 0.9.0..0.10.0-RC1` these are: |
| 189 | + |
| 190 | +``` |
| 191 | + 219 Martin Odersky |
| 192 | + 142 Nicolas Stucki |
| 193 | + 67 Paolo G. Giarrusso |
| 194 | + 52 Allan Renucci |
| 195 | + 48 Guillaume Martres |
| 196 | + 39 Martin Duhem |
| 197 | + 23 Liu Fengyun |
| 198 | + 15 Olivier Blanvillain |
| 199 | + 10 Dmytro Melnychenko |
| 200 | + 10 Abel Nieto |
| 201 | + 10 Sébastien Doeraene |
| 202 | + 7 Jaemin Hong |
| 203 | + 7 Eugene Melekhov |
| 204 | + 5 Saloni Vithalani |
| 205 | + 3 Daniel Li |
| 206 | + 3 Dale Wijnand |
| 207 | + 3 Jasper Moeys |
| 208 | + 2 lloydmeta |
| 209 | + 2 Aggelos Biboudis |
| 210 | + 2 Greg Pevnev |
| 211 | + 1 Adriaan Moors |
| 212 | + 1 Lukas Rytz |
| 213 | + 1 Kazuhiro Sera |
| 214 | + 1 Justin du Coeur, AKA Mark Waks |
| 215 | + 1 Jan Rock |
| 216 | + 1 Fengyun Liu |
| 217 | + 1 Szymon Pajzert |
| 218 | + 1 Chris Birchall |
| 219 | + 1 benkobalog |
| 220 | + 1 Martijn Hoekstra |
| 221 | +``` |
| 222 | + |
| 223 | +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! |
| 224 | +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), |
| 225 | +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). |
| 226 | +They make perfect entry points into hacking on the compiler. |
| 227 | + |
| 228 | +We are looking forward to having you join the team of contributors. |
| 229 | + |
| 230 | +## Library authors: Join our community build |
| 231 | + |
| 232 | +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty |
| 233 | +snapshot. Currently this includes ScalaPB, algebra, scalatest, scopt and squants. |
| 234 | +Join our [community build](https://github.com/lampepfl/dotty-community-build) |
| 235 | +to make sure that our regression suite includes your library. |
| 236 | + |
| 237 | +[Scastie]: https://scastie.scala-lang.org/?target=dotty |
| 238 | + |
| 239 | +[@odersky]: https://github.com/odersky |
| 240 | +[@DarkDimius]: https://github.com/DarkDimius |
| 241 | +[@smarter]: https://github.com/smarter |
| 242 | +[@felixmulder]: https://github.com/felixmulder |
| 243 | +[@nicolasstucki]: https://github.com/nicolasstucki |
| 244 | +[@liufengyun]: https://github.com/liufengyun |
| 245 | +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain |
| 246 | +[@biboudis]: https://github.com/biboudis |
| 247 | +[@allanrenucci]: https://github.com/allanrenucci |
| 248 | +[@Blaisorblade]: https://github.com/Blaisorblade |
| 249 | +[@Duhemm]: https://github.com/Duhemm |
0 commit comments