@@ -3,7 +3,7 @@ layout: blog-page
3
3
title : Announcing Dotty 0.13.0-RC1 with Spark support and redesigned implicits
4
4
author : Aggelos Biboudis
5
5
authorImg : /images/aggelos.jpg
6
- date : 2019-03-01
6
+ date : 2019-03-04
7
7
---
8
8
9
9
Hello hello! This is the second release for 2019, let's call it the _ Contextual_
@@ -13,22 +13,23 @@ Without further ado, today we release the version 0.13.0-RC1 of the Dotty compil
13
13
This release serves as a technology preview that demonstrates new language features and the
14
14
compiler supporting them.
15
15
16
- Dotty is the project name for technologies that are considered for inclusion in Scala 3. Scala has
17
- pioneered the fusion of object-oriented and functional programming in a typed setting. Scala 3 will
18
- be a big step towards realising the full potential of these ideas. Its main objectives are to
16
+ Dotty is the project name for technologies that are being considered for
17
+ inclusion in Scala 3. Scala has pioneered the fusion of object-oriented and
18
+ functional programming in a typed setting. Scala 3 will be a big step towards
19
+ realising the full potential of these ideas. Its main objectives are to
19
20
20
21
- become more opinionated by promoting programming idioms we found to work well,
21
22
- simplify where possible,
22
23
- eliminate inconsistencies and surprising behaviours,
23
- - build on strong foundations to ensure the design hangs well together,
24
+ - build on strong foundations to ensure the design hangs together well ,
24
25
- consolidate language constructs to improve the language’s consistency, safety, ergonomics, and
25
26
performance.
26
27
27
28
You can learn more about Dotty on our [ website] ( https://dotty.epfl.ch ) .
28
29
29
30
<!-- more-->
30
31
31
- This is our 132th scheduled release according to our
32
+ This is our 13th scheduled release according to our
32
33
[ 6-week release schedule] ( https://dotty.epfl.ch/docs/usage/version-numbers.html ) .
33
34
34
35
# What’s new in the 0.13.0-RC1 technology preview?
@@ -62,9 +63,9 @@ varied number of use cases, among them: implementing type classes, establishing
62
63
context, dependency injection, expressing capabilities, computing new types and
63
64
proving relationships between them.
64
65
65
- However, we identify a few side-effects that implicits gave rise to, as a
66
+ However, we identify a few consequences that implicits gave rise to, as a
66
67
programming style. Firstly, users used implicit conversions between types, in an
67
- undisciplined matter. This overuse of implicit conversions declattered code for
68
+ unprincipled matter. This overuse of implicit conversions decluttered code for
68
69
sure, but it made it harder for people to reason about.
69
70
70
71
``` scala
@@ -77,14 +78,17 @@ implicit values and we identify that their semantic differences must be
77
78
communicated more clearly syntactically. Secondly, implicits pose challenges for
78
79
tooling such as error reporting for failed implicit searches. Furthermore, the
79
80
` implicit ` keyword is way too overloaded (implicit vals, defs, objects,
80
- parameters, or arguments) and users may use it as a mechanism rather than an
81
- intent. Another consideration is that the ` implicit ` keyword annotates a whole
82
- parameter section instead of a single parameter, and passing an argument to an
83
- implicit parameter looks like a regular application. This is problematic because
84
- it can create confusion regarding what parameter gets instantiated in a call.
85
- Last but not least, some times implicit parameters are merely propagated in
86
- nested function calls and not used at all, so names of implicit parameters are
87
- not always necessary.
81
+ parameters). For instance, a newcomer can easily confuse the two
82
+ examples above while they demonstrate completely different things, a typeclass
83
+ instance is an implicit object or val if unconditional and an implicit def with
84
+ implicit parameters if conditional; arguably all of them are surprisingly
85
+ similar (syntactically). Another consideration is that the ` implicit ` keyword
86
+ annotates a whole parameter section instead of a single parameter, and passing
87
+ an argument to an implicit parameter looks like a regular application. This is
88
+ problematic because it can create confusion regarding what parameter gets passed
89
+ in a call. Last but not least, sometimes implicit parameters are merely
90
+ propagated in nested function calls and not used at all, so names of implicit
91
+ parameters are not always necessary.
88
92
89
93
Consequently, we introduce two new language features:
90
94
@@ -154,7 +158,7 @@ implied ctx for ExecutionContext = currentThreadPool().context
154
158
For symmetry, we define our well-known ` implicitly ` from ` Predef ` in terms of
155
159
` given ` and for simplicity we rename it to ` the ` . Functions like ` the ` that have
156
160
only _ inferable parameters_ are also called _ context queries_ from now on.
157
- Consequently, to create an implied instance of ` Ord[List[Int]] ` we write:
161
+ Consequently, to summon an implied instance of ` Ord[List[Int]] ` we write:
158
162
159
163
``` scala
160
164
the[Ord [List [Int ]]]
@@ -188,7 +192,7 @@ parameters. Here is an example of such a function:
188
192
type Contextual [T ] = given Context => T
189
193
```
190
194
191
- Context queries--previously named implicit function types--are now also
195
+ Context queries--previously named implicit function types (IFTs) --are now also
192
196
expressed with ` given ` , providing types for first-class context queries. This is
193
197
merely an alignment of IFTs into the new scheme.
194
198
@@ -250,7 +254,7 @@ for a deep dive at the relevant PRs:
250
254
[ #5540 ] ( https://github.com/lampepfl/dotty/pull/5540 ) and
251
255
[ #5839 ] ( https://github.com/lampepfl/dotty/pull/5839 ) .
252
256
253
- ` Multiversal equality ` is now supported through the ` Eql ` marker trait (renamed
257
+ _ Multiversal equality _ is now supported through the ` Eql ` marker trait (renamed
254
258
from ` Eq ` to differentiate it from Cats' ` Eq ` ). For example, in order to be able
255
259
to compare integers with strings now, instead of a custom implicit we can
256
260
provide a derived implicit instance:
@@ -271,9 +275,26 @@ implied for Conversion[String, Token] {
271
275
}
272
276
```
273
277
274
- It is worth mentioning that we now allow arbitrary definitions at the toplevel.
275
- This means package objects are now redundant, and will be phased out.
276
- You can read about [ dropping package objects] ( https://dotty.epfl.ch/docs/reference/dropped-features/package-objects.html )
278
+ _ Top level_ definitions are now supported. This means that package objects are
279
+ now redundant, and will be phased out. This means that all kinds of definitions
280
+ can be written at the top level.
281
+
282
+ ``` scala
283
+ package p .
284
+
285
+ type Labelled [T ] = (String , T )
286
+ val a : Labelled [Int ] = (" count" , 1 )
287
+ def b = a._2
288
+
289
+ case class C ()
290
+
291
+ implicit object Cops {
292
+ def (x : C ) pair (y : C ) = (x, y)
293
+ }
294
+ ```
295
+
296
+ You can read about [ dropping package
297
+ objects] ( https://dotty.epfl.ch/docs/reference/dropped-features/package-objects.html )
277
298
at the documentation linked or at the relevant PR
278
299
[ #5754 ] ( https://github.com/lampepfl/dotty/pull/5754 ) .
279
300
@@ -301,10 +322,6 @@ first prototype for the generation of SemanticDB information from TASTy.
301
322
302
323
## And much more!
303
324
304
- Other significant changes in this release are the following:
305
-
306
-
307
-
308
325
Please read our [ release notes] ( https://github.com/lampepfl/dotty/releases/tag/0.13.0-RC1 )
309
326
for more details!
310
327
@@ -321,11 +338,11 @@ sbt new lampepfl/dotty.g8
321
338
For more details on using Dotty with sbt, see the
322
339
[ example project] ( https://github.com/lampepfl/dotty-example-project ) .
323
340
324
- ## [ Mill] ( http://www.lihaoyi.com/mill/ )
341
+ <!-- ## [Mill](http://www.lihaoyi.com/mill/)
325
342
326
343
The Mill build tool version 0.2.6 introduced experimental support for Dotty. For more details on
327
344
using Dotty with Mill, see the
328
- [ example project] ( https://github.com/lampepfl/dotty-example-project/tree/mill ) .
345
+ [example project](https://github.com/lampepfl/dotty-example-project/tree/mill). -->
329
346
330
347
## IDE support
331
348
@@ -338,7 +355,7 @@ Releases are available for download on the _Releases_
338
355
section of the Dotty repository:
339
356
[ https://github.com/lampepfl/dotty/releases ] ( https://github.com/lampepfl/dotty/releases )
340
357
341
- For MacOs users, we also provide a [ homebrew] ( https://brew.sh/ ) package that can be installed by
358
+ For macOS users, we also provide a [ homebrew] ( https://brew.sh/ ) package that can be installed by
342
359
running:
343
360
344
361
``` shell
0 commit comments