Skip to content

Commit 463e8b4

Browse files
committed
Draft Dotty 0.11.0-RC1 blog post
1 parent 63ee01a commit 463e8b4

File tree

1 file changed

+207
-0
lines changed

1 file changed

+207
-0
lines changed
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
---
2+
layout: blog-page
3+
title: Announcing Dotty 0.11.0-RC1
4+
author: Allan Renucci
5+
authorImg: /images/allan.jpg
6+
date: 2018-11-17
7+
---
8+
9+
Today we are excited to release Dotty version 0.11.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 11th 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.11.0-RC1 technology preview?
32+
33+
### Opaque Type Aliases
34+
35+
Opaque types aliases provide type abstraction without any overhead. Example:
36+
37+
```scala
38+
opaque type Logarithm = Double
39+
```
40+
41+
This introduces `Logarithm` as a new type, which is implemented as `Double` but is different from
42+
it. The fact that `Logarithm` is the same as `Double` is only known in the companion object of
43+
`Logarithm`. Here is a possible companion object:
44+
45+
```scala
46+
object Logarithm {
47+
48+
// These are the ways to lift to the logarithm type
49+
def apply(d: Double): Logarithm = math.log(d)
50+
51+
def safe(d: Double): Option[Logarithm] =
52+
if (d > 0.0) Some(math.log(d)) else None
53+
54+
// This is the first way to unlift the logarithm type
55+
def exponent(l: Logarithm): Double = l
56+
57+
// Extension methods define opaque types' public APIs
58+
implicit class LogarithmOps(val `this`: Logarithm) extends AnyVal {
59+
// This is the second way to unlift the logarithm type
60+
def toDouble: Double = math.exp(`this`)
61+
def +(that: Logarithm): Logarithm = Logarithm(math.exp(`this`) + math.exp(that))
62+
def *(that: Logarithm): Logarithm = Logarithm(`this` + that)
63+
}
64+
}
65+
```
66+
67+
The companion object contains with the `apply` and `safe` methods ways to convert from doubles to
68+
`Logarithm` values. It also adds an `exponent` function and a decorator that implements `+` and `*`
69+
on logarithm values, as well as a conversion `toDouble`. All this is possible because within object
70+
`Logarithm`, the type `Logarithm` is just an alias of `Double`.
71+
72+
Outside the companion object, `Logarithm` is treated as a new abstract type. So the following
73+
operations would be valid because they use functionality implemented in the `Logarithm`
74+
object.
75+
76+
```scala
77+
val l = Logarithm(1.0)
78+
val l3 = l * l2
79+
val l4 = l + l2
80+
```
81+
82+
But the following operations would lead to type errors:
83+
84+
```scala
85+
val d: Double = l // error: found: Logarithm, required: Double
86+
val l2: Logarithm = 1.0 // error: found: Double, required: Logarithm
87+
l * 2 // error: found: Int(2), required: Logarithm
88+
l / l2 // error: `/` is not a member fo Logarithm
89+
```
90+
91+
### Worksheet Mode Support in Visual Studio Code
92+
93+
???
94+
95+
### And much more!
96+
97+
Please read our [release notes](https://github.com/lampepfl/dotty/releases/tag/0.11.0-RC1)
98+
for more details!
99+
100+
## Trying out Dotty
101+
102+
### sbt
103+
104+
You can setup a new sbt project with Dotty as the compiler by running:
105+
106+
```shell
107+
sbt new lampepfl/dotty.g8
108+
```
109+
110+
For more details on using Dotty with sbt, see the
111+
[example project](https://github.com/lampepfl/dotty-example-project).
112+
113+
### [Mill](http://www.lihaoyi.com/mill/)
114+
115+
The Mill build tool version 0.2.6 introduced experimental support for Dotty. For more details on
116+
using Dotty with Mill, see the
117+
[example project](https://github.com/lampepfl/dotty-example-project/tree/mill).
118+
119+
### IDE support
120+
121+
Start using the Dotty IDE in any Dotty project by following
122+
the [IDE guide](https://dotty.epfl.ch/docs/usage/ide-support.html).
123+
124+
### Standalone installation
125+
126+
Releases are available for download on the _Releases_
127+
section of the Dotty repository:
128+
[https://github.com/lampepfl/dotty/releases](https://github.com/lampepfl/dotty/releases)
129+
130+
For MacOs users, we also provide a [homebrew](https://brew.sh/) package that can be installed by
131+
running:
132+
133+
```shell
134+
brew install lampepfl/brew/dotty
135+
```
136+
137+
In case you have already installed Dotty via `brew`, you should instead update it:
138+
139+
```shell
140+
brew upgrade dotty
141+
```
142+
143+
## Let us know what you think!
144+
145+
If you have questions or any sort of feedback, feel free to send us a message on our
146+
[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please
147+
[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new).
148+
149+
## Contributing
150+
151+
Thank you to all the contributors who made this release possible!
152+
153+
According to `git shortlog -sn --no-merges 0.10.0..0.11.0-RC1` these are:
154+
155+
```
156+
143 Martin Duhem
157+
104 Nicolas Stucki
158+
82 Martin Odersky
159+
60 Guillaume Martres
160+
35 Allan Renucci
161+
21 poechsel
162+
12 Olivier Blanvillain
163+
10 Liu Fengyun
164+
8 Aleksander Boruch-Gruszecki
165+
6 Tobias Bordenca
166+
5 Sébastien Doeraene
167+
4 Stéphane Micheloud
168+
3 João Pedro Evangelista
169+
3 Miles Sabin
170+
3 Neeraj Jaiswal
171+
3 Abel Nieto
172+
2 Ólafur Páll Geirsson
173+
2 Fengyun Liu
174+
2 veera venky
175+
1 mikhail
176+
1 Glavo
177+
1 0xflotus
178+
1 Paolo G. Giarrusso
179+
```
180+
181+
If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved!
182+
Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html),
183+
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).
184+
They make perfect entry points into hacking on the compiler.
185+
186+
We are looking forward to having you join the team of contributors.
187+
188+
## Library authors: Join our community build
189+
190+
Dotty now has a set of widely-used community libraries that are built against every nightly Dotty
191+
snapshot. Currently this includes ScalaPB, algebra, scalatest, scopt and squants.
192+
Join our [community build](https://github.com/lampepfl/dotty-community-build)
193+
to make sure that our regression suite includes your library.
194+
195+
[Scastie]: https://scastie.scala-lang.org/?target=dotty
196+
197+
[@odersky]: https://github.com/odersky
198+
[@DarkDimius]: https://github.com/DarkDimius
199+
[@smarter]: https://github.com/smarter
200+
[@felixmulder]: https://github.com/felixmulder
201+
[@nicolasstucki]: https://github.com/nicolasstucki
202+
[@liufengyun]: https://github.com/liufengyun
203+
[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain
204+
[@biboudis]: https://github.com/biboudis
205+
[@allanrenucci]: https://github.com/allanrenucci
206+
[@Blaisorblade]: https://github.com/Blaisorblade
207+
[@Duhemm]: https://github.com/Duhemm

0 commit comments

Comments
 (0)