Skip to content

Commit 3d69f64

Browse files
committed
Draft Dotty 0.8.0 blog post
1 parent 8feb596 commit 3d69f64

File tree

1 file changed

+180
-0
lines changed

1 file changed

+180
-0
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
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-26
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+
If you’re not familiar with Dotty, it's a platform to try out new language concepts and compiler
13+
technologies for Scala. The focus is mainly on simplification. We remove extraneous syntax
14+
(e.g. no XML literals), and try to boil down Scala’s types into a smaller set of more fundamental
15+
constructs. The theory behind these constructs is researched in
16+
[DOT](https://infoscience.epfl.ch/record/215280), a calculus for dependent object types.
17+
You can learn more about Dotty on our [website](https://dotty.epfl.ch).
18+
19+
<!--more-->
20+
21+
This is our eighth scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html).
22+
The [previous technology preview](https://github.com/lampepfl/dotty/releases/tag/0.7.0-RC1) simplified
23+
enums, introduced erased terms, improved IDE support and improved pattern matching for GADT.
24+
25+
## What’s new in the 0.8.0-RC1 technology preview?
26+
27+
### sbt 1 support [#3872](https://github.com/lampepfl/dotty/pull/3872)
28+
Starting with Dotty 0.8.0, we will only support versions of sbt >= 1.1.4. Migrating to sbt 1
29+
lets us use the new improved incremental compiler for Scala called [Zinc](https://github.com/sbt/zinc),
30+
and enables integration with tools such as [Bloop](https://scalacenter.github.io/bloop/).
31+
32+
### Unchecked warnings [#4045](https://github.com/lampepfl/dotty/pull/4045)
33+
Dotty now emits `unchecked` warnings like `scalac` whenever a type test is performed but cannot
34+
safely be checked at runtime. For example:
35+
36+
```scala
37+
scala> def foo(x: Any) = x.isInstanceOf[List[String]]
38+
1 |def foo(x: Any) = x.isInstanceOf[List[String]]
39+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40+
| the type test for List[String] cannot be checked at runtime
41+
```
42+
43+
In some cases, the Dotty compiler is smarter than `scalac` and will not emit a warning:
44+
```scala
45+
trait Marker
46+
47+
def foo[T](x: T) = x match {
48+
case _: T with Marker => // scalac emits a spurious warning
49+
case _ =>
50+
}
51+
```
52+
53+
### Kind Polymorphism [#4108](https://github.com/lampepfl/dotty/pull/4108)
54+
Normally type parameters in Scala are partitioned into kinds. First-level types are types of values.
55+
Higher-kinded types are type constructors such as `List` or `Map`. The kind of a type is indicated
56+
by the top type of which it is a subtype. Normal types are subtypes of `Any`, covariant single
57+
argument type constructors such as List are subtypes of `[+X] => Any`, and the `Map` type
58+
constructor is a subtype of `[X, +Y] => Any`.
59+
60+
Sometimes we would like to have type parameters that can have more than one kind, for instance to
61+
define an implicit value that works for parameters of any kind. This is now possible through a form
62+
of (subtype) kind polymorphism. Kind polymorphism relies on the special type `scala.AnyKind` that
63+
can be used as an upper bound of a type.
64+
65+
```scala
66+
def f[T <: AnyKind] = ..
67+
```
68+
69+
The actual type arguments of f can then be types of arbitrary kinds. So the following would all be
70+
legal:
71+
72+
```scala
73+
f[Int]
74+
f[List]
75+
f[Map]
76+
f[[X] => String]
77+
```
78+
79+
**Note**: This feature is considered experimental and is only enabled under a compiler flag
80+
(i.e. `-Ykind-polymorphism`). For more information, visit the [Kind Polymorphism](https://dotty.epfl.ch/docs/reference/kind-polymorphism.html)
81+
section of our documentation.
82+
83+
### Improved support for SAM type [#4152](https://github.com/lampepfl/dotty/pull/4152)
84+
This release includes fixes to SAM types that greatly improve interoperability with Java 8 lambdas.
85+
One can now easely write Scala code that uses Java streams:
86+
87+
```scala
88+
val myList =
89+
java.util.Arrays.asList("a1", "a2", "b1", "c2", "c1")
90+
91+
myList
92+
.stream
93+
.filter(s => s.startsWith("c"))
94+
.map(_.toUpperCase)
95+
.sorted
96+
.forEach(println(_))
97+
98+
// C1
99+
// C2
100+
```
101+
102+
## Trying out Dotty
103+
### Scastie
104+
[Scastie], the online Scala playground, supports Dotty.
105+
This is an easy way to try Dotty without installing anything.
106+
107+
### sbt
108+
Using sbt 1.1.4 or newer, do:
109+
110+
```shell
111+
sbt new lampepfl/dotty.g8
112+
```
113+
114+
This will setup a new sbt project with Dotty as compiler. For more details on
115+
using Dotty with sbt, see the
116+
[example project](https://github.com/lampepfl/dotty-example-project).
117+
118+
### IDE support
119+
It is very easy to start using the Dotty IDE in any Dotty project by following
120+
the [IDE guide](https://dotty.epfl.ch/docs/usage/ide-support.html).
121+
122+
123+
### Standalone installation
124+
Releases are available for download on the _Releases_
125+
section of the Dotty repository:
126+
[https://github.com/lampepfl/dotty/releases](https://github.com/lampepfl/dotty/releases)
127+
128+
We also provide a [homebrew](https://brew.sh/) package that can be installed by running:
129+
130+
```shell
131+
brew install lampepfl/brew/dotty
132+
```
133+
134+
In case you have already installed Dotty via brew, you should instead update it:
135+
136+
```shell
137+
brew upgrade dotty
138+
```
139+
140+
## Let us know what you think!
141+
If you have questions or any sort of feedback, feel free to send us a message on our
142+
[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please
143+
[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new).
144+
145+
## Contributing
146+
Thank you to all the contributors who made this release possible!
147+
148+
According to `git shortlog -sn --no-merges 0.7.0..0.8.0-RC1` these are:
149+
150+
```
151+
TODO
152+
```
153+
154+
If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved!
155+
Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html),
156+
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).
157+
They make perfect entry-points into hacking on the compiler.
158+
159+
We are looking forward to having you join the team of contributors.
160+
161+
## Library authors: Join our community build
162+
Dotty now has a set of widely-used community libraries that are built against every nightly Dotty
163+
snapshot. Currently this includes ScalaPB, algebra, scalatest, scopt and squants.
164+
Join our [community build](https://github.com/lampepfl/dotty-community-build)
165+
to make sure that our regression suite includes your library.
166+
167+
168+
[Scastie]: https://scastie.scala-lang.org/?target=dotty
169+
170+
[@odersky]: https://github.com/odersky
171+
[@DarkDimius]: https://github.com/DarkDimius
172+
[@smarter]: https://github.com/smarter
173+
[@felixmulder]: https://github.com/felixmulder
174+
[@nicolasstucki]: https://github.com/nicolasstucki
175+
[@liufengyun]: https://github.com/liufengyun
176+
[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain
177+
[@biboudis]: https://github.com/biboudis
178+
[@allanrenucci]: https://github.com/allanrenucci
179+
[@Blaisorblade]: https://github.com/Blaisorblade
180+
[@Duhemm]: https://github.com/Duhemm

0 commit comments

Comments
 (0)