|
| 1 | +--- |
| 2 | +layout: blog-page |
| 3 | +title: Announcing Dotty 0.7.0 and 0.8.0-RC1 |
| 4 | +author: Allan Renucci |
| 5 | +authorImg: /images/allan.jpg |
| 6 | +date: 2018-04-27 |
| 7 | +--- |
| 8 | + |
| 9 | +Today, we are excited to release Dotty versions 0.7.0 and 0.8.0-RC1. These releases |
| 10 | +serve as a technology preview that demonstrates new language features and the compiler supporting them. |
| 11 | + |
| 12 | +Dotty is the project name for technologies that are considered for inclusion in Scala 3. Scala has |
| 13 | +pioneered the fusion of object-oriented and functional programming in a typed setting. Scala 3 will |
| 14 | +be a big step towards realizing the full potential of these ideas. Its main objectives are to |
| 15 | +- become more opinionated by promoting programming idioms we found to work well, |
| 16 | +- simplify where possible, |
| 17 | +- eliminate inconsistencies and surprising behaviors, |
| 18 | +- build on strong foundations to ensure the design hangs well together, |
| 19 | +- consolidate language constructs to improve the language’s consistency, safety, ergonomics, and performance. |
| 20 | + |
| 21 | +You can learn more about Dotty on our [website](https://dotty.epfl.ch). |
| 22 | + |
| 23 | +<!--more--> |
| 24 | + |
| 25 | +This is our eighth scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). |
| 26 | +The [previous technology preview](https://github.com/lampepfl/dotty/releases/tag/0.7.0-RC1) simplified |
| 27 | +enums, introduced erased terms, improved IDE support and improved pattern matching for GADT. |
| 28 | + |
| 29 | +## What’s new in the 0.8.0-RC1 technology preview? |
| 30 | + |
| 31 | +### sbt 1 support [#3872](https://github.com/lampepfl/dotty/pull/3872) |
| 32 | +Starting with Dotty 0.8.0, we will only support versions of sbt >= 1.1.4. Migrating to sbt 1 |
| 33 | +lets us use the new improved incremental compiler for Scala called [Zinc](https://github.com/sbt/zinc), |
| 34 | +and enables integration with tools such as [Bloop](https://scalacenter.github.io/bloop/). |
| 35 | + |
| 36 | +If you are already using Dotty with sbt 0.13, follow these simple steps to upgrade: |
| 37 | +- update sbt version to 1.1.4 in `project/build.properties` |
| 38 | +- update sbt-dotty plugin to the latest version: `addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.2.2")` |
| 39 | +- replace usages of `.withDottyCompat()` by `.withDottyCompat(scalaVersion.value)` |
| 40 | + |
| 41 | +### Unchecked warnings [#4045](https://github.com/lampepfl/dotty/pull/4045) |
| 42 | +Dotty now emits `unchecked` warnings like `scalac` whenever a type test is performed but cannot be |
| 43 | +fully checked at runtime because of type erasure. For example: |
| 44 | + |
| 45 | +```scala |
| 46 | +scala> def foo(x: Any) = x.isInstanceOf[List[String]] |
| 47 | +1 |def foo(x: Any) = x.isInstanceOf[List[String]] |
| 48 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 49 | + | the type test for List[String] cannot be checked at runtime |
| 50 | +``` |
| 51 | + |
| 52 | +In some cases, the Dotty compiler is smarter than `scalac` and will not emit a warning: |
| 53 | +```scala |
| 54 | +trait Marker |
| 55 | + |
| 56 | +def foo[T](x: T) = x match { |
| 57 | + case _: T with Marker => // scalac emits a spurious warning |
| 58 | + case _ => |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +### Kind Polymorphism [#4108](https://github.com/lampepfl/dotty/pull/4108) |
| 63 | +Normally type parameters in Scala are partitioned into kinds. First-level types are types of values. |
| 64 | +Higher-kinded types are type constructors such as `List` or `Map`. The kind of a type is indicated |
| 65 | +by the top type of which it is a subtype. Normal types are subtypes of `Any`, covariant single |
| 66 | +argument type constructors such as List are subtypes of `[+X] => Any`, and the `Map` type |
| 67 | +constructor is a subtype of `[X, +Y] => Any`. |
| 68 | + |
| 69 | +Sometimes we would like to have type parameters that can have more than one kind, for instance to |
| 70 | +define an implicit value that works for parameters of any kind. This is now possible through a form |
| 71 | +of (subtype) kind polymorphism. Kind polymorphism relies on the special type `scala.AnyKind` that |
| 72 | +can be used as an upper bound of a type. |
| 73 | + |
| 74 | +```scala |
| 75 | +def f[T <: AnyKind] = .. |
| 76 | +``` |
| 77 | + |
| 78 | +The actual type arguments of f can then be types of arbitrary kinds. So the following would all be |
| 79 | +legal: |
| 80 | + |
| 81 | +```scala |
| 82 | +f[Int] |
| 83 | +f[List] |
| 84 | +f[Map] |
| 85 | +f[[X] => String] |
| 86 | +``` |
| 87 | + |
| 88 | +**Note**: This feature is considered experimental and is only enabled under a compiler flag |
| 89 | +(i.e. `-Ykind-polymorphism`). For more information, visit the [Kind Polymorphism](https://dotty.epfl.ch/docs/reference/kind-polymorphism.html) |
| 90 | +section of our documentation. |
| 91 | + |
| 92 | +### Improved support for SAM type [#4152](https://github.com/lampepfl/dotty/pull/4152) |
| 93 | +This release includes fixes to [SAM types](https://www.scala-lang.org/news/2.12.0/#lambda-syntax-for-sam-types) |
| 94 | +that greatly improve interoperability with Java 8 lambdas. One can now easily write Scala code that |
| 95 | +uses Java streams: |
| 96 | + |
| 97 | +```scala |
| 98 | +val myList = |
| 99 | + java.util.Arrays.asList("a1", "a2", "b1", "c2", "c1") |
| 100 | + |
| 101 | +myList |
| 102 | + .stream |
| 103 | + .filter(s => s.startsWith("c")) |
| 104 | + .map(_.toUpperCase) |
| 105 | + .sorted |
| 106 | + .forEach(println(_)) |
| 107 | + |
| 108 | +// prints: |
| 109 | +// C1 |
| 110 | +// C2 |
| 111 | +``` |
| 112 | + |
| 113 | +## Trying out Dotty |
| 114 | +### Scastie |
| 115 | +[Scastie], the online Scala playground, supports Dotty. |
| 116 | +This is an easy way to try Dotty without installing anything. |
| 117 | + |
| 118 | +### sbt |
| 119 | +Using sbt 1.1.4 or newer, do: |
| 120 | + |
| 121 | +```shell |
| 122 | +sbt new lampepfl/dotty.g8 |
| 123 | +``` |
| 124 | + |
| 125 | +This will setup a new sbt project with Dotty as compiler. For more details on |
| 126 | +using Dotty with sbt, see the |
| 127 | +[example project](https://github.com/lampepfl/dotty-example-project). |
| 128 | + |
| 129 | +### IDE support |
| 130 | +It is very easy to start using the Dotty IDE in any Dotty project by following |
| 131 | +the [IDE guide](https://dotty.epfl.ch/docs/usage/ide-support.html). |
| 132 | + |
| 133 | + |
| 134 | +### Standalone installation |
| 135 | +Releases are available for download on the _Releases_ |
| 136 | +section of the Dotty repository: |
| 137 | +[https://github.com/lampepfl/dotty/releases](https://github.com/lampepfl/dotty/releases) |
| 138 | + |
| 139 | +We also provide a [homebrew](https://brew.sh/) package that can be installed by running: |
| 140 | + |
| 141 | +```shell |
| 142 | +brew install lampepfl/brew/dotty |
| 143 | +``` |
| 144 | + |
| 145 | +In case you have already installed Dotty via brew, you should instead update it: |
| 146 | + |
| 147 | +```shell |
| 148 | +brew upgrade dotty |
| 149 | +``` |
| 150 | + |
| 151 | +## Let us know what you think! |
| 152 | +If you have questions or any sort of feedback, feel free to send us a message on our |
| 153 | +[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please |
| 154 | +[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). |
| 155 | + |
| 156 | +## Contributing |
| 157 | +Thank you to all the contributors who made this release possible! |
| 158 | + |
| 159 | +According to `git shortlog -sn --no-merges 0.7.0..0.8.0-RC1` these are: |
| 160 | + |
| 161 | +``` |
| 162 | + 95 Martin Odersky |
| 163 | + 91 liu fengyun |
| 164 | + 91 Nicolas Stucki |
| 165 | + 84 Allan Renucci |
| 166 | + 73 Guillaume Martres |
| 167 | + 67 Martin Duhem |
| 168 | + 18 Jendrik Wenke |
| 169 | + 16 Paolo G. Giarrusso |
| 170 | + 8 Robert Stoll |
| 171 | + 6 Thierry Treyer |
| 172 | + 4 Aggelos Biboudis |
| 173 | + 1 tokkiyaa |
| 174 | + 1 Rajesh Veeranki |
| 175 | + 1 Maxime Kjaer |
| 176 | + 1 Saurabh Rawat |
| 177 | + 1 Joan |
| 178 | + 1 Jorge Vicente Cantero |
| 179 | + 1 Jasper Moeys |
| 180 | + 1 Piotr Gabara |
| 181 | +``` |
| 182 | + |
| 183 | +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! |
| 184 | +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), |
| 185 | +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). |
| 186 | +They make perfect entry-points into hacking on the compiler. |
| 187 | + |
| 188 | +We are looking forward to having you join the team of contributors. |
| 189 | + |
| 190 | +## Library authors: Join our community build |
| 191 | +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty |
| 192 | +snapshot. Currently this includes ScalaPB, algebra, scalatest, scopt and squants. |
| 193 | +Join our [community build](https://github.com/lampepfl/dotty-community-build) |
| 194 | +to make sure that our regression suite includes your library. |
| 195 | + |
| 196 | + |
| 197 | +[Scastie]: https://scastie.scala-lang.org/?target=dotty |
| 198 | + |
| 199 | +[@odersky]: https://github.com/odersky |
| 200 | +[@DarkDimius]: https://github.com/DarkDimius |
| 201 | +[@smarter]: https://github.com/smarter |
| 202 | +[@felixmulder]: https://github.com/felixmulder |
| 203 | +[@nicolasstucki]: https://github.com/nicolasstucki |
| 204 | +[@liufengyun]: https://github.com/liufengyun |
| 205 | +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain |
| 206 | +[@biboudis]: https://github.com/biboudis |
| 207 | +[@allanrenucci]: https://github.com/allanrenucci |
| 208 | +[@Blaisorblade]: https://github.com/Blaisorblade |
| 209 | +[@Duhemm]: https://github.com/Duhemm |
0 commit comments