Skip to content

Commit 8d5f56f

Browse files
Merge pull request #9425 from dotty-staging/26-release-blog-post
Add 26th release blog post
2 parents 624cb69 + f112273 commit 8d5f56f

File tree

2 files changed

+150
-1
lines changed

2 files changed

+150
-1
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
layout: blog-page
3+
title: Announcing Dotty 0.26.0-RC1 - unified extension methods and more
4+
author: Anatolii Kmetiuk
5+
authorImg: /images/anatolii.png
6+
date: 2020-07-27
7+
---
8+
9+
Hello! We are excited to announce 0.26.0-RC1 of Dotty. In this version, we have improved the extension methods – their syntax is now more uniform. We have also implemented local selectable instances and have done a bunch of improvements to the compiler and the language API. Otherwise, we are focusing our efforts on reducing the issue count on the issue tracker, boosting performance and improving the stability of the compiler in other ways.
10+
11+
You can try out this version right now, from the comfort of your SBT, by visiting the [home page](https://dotty.epfl.ch/) and scrolling down to the "Create a Dotty Project" section.
12+
13+
Alternatively, you can try this version of Scala online via [Scastie](https://scastie.scala-lang.org/). Once you're there, click "Build Settings" and set "Target" to "Dotty".
14+
15+
Enjoy the ride🚀!
16+
17+
<!--more-->
18+
# Unified extension methods
19+
In this release, we have made extension method syntax uniform. Previously, we had three separate syntaxes for single extension methods, collective extension methods and given instances with extension methods. Now, these three cases have been unified into one. The new syntax looks like follows:
20+
21+
```scala
22+
extension (x: String)
23+
def < (y: String): Boolean = ...
24+
```
25+
26+
Collective extensions look like follows:
27+
28+
```scala
29+
extension (ss: Seq[String]):
30+
31+
def longestStrings: Seq[String] =
32+
val maxLength = ss.map(_.length).max
33+
ss.filter(_.length == maxLength)
34+
35+
def longestString: String = longestStrings.head
36+
```
37+
38+
You can read more about the new syntax in the [documentation](https://dotty.epfl.ch/docs/reference/contextual/extension-methods.html). For the discussion, see [PR](https://github.com/lampepfl/dotty/pull/9255).
39+
40+
# Local Selectable Instances
41+
Local and anonymous classes that extend `Selectable` get more refined types than other classes. For example:
42+
43+
```scala
44+
trait Vehicle extends reflect.Selectable {
45+
val wheels: Int
46+
}
47+
val i3 = new Vehicle { // i3: Vehicle { val range: Int }
48+
val wheels = 4
49+
val range = 240
50+
}
51+
i3.range
52+
```
53+
54+
Without the `extends reflect.Selectbale`, the last line would have errored:
55+
56+
```scala
57+
i3.range: // error: range is not a member of `Vehicle`
58+
```
59+
60+
The new functionality is similar to `scala.Dynamic` but different since `Selectable` is typesafe. For more about this feature, see [documentation](https://dotty.epfl.ch/docs/reference/changed-features/structural-types.html#local-selectable-instances).
61+
62+
# Tuple counterparts for `summon` and `constValue`
63+
Two new methods for compile-time programming were added, `summonAll` and `constValueTuple`.
64+
65+
`summonAll[T <: Tuple]` takes a tuple type, summons all the members of it and returns them as a tuple. For example:
66+
67+
```scala
68+
given as Int = 10
69+
given as String = "foo"
70+
given as Double = 1.2
71+
println(summonAll[Int *: String *: Double *: EmptyTuple]) // (10,foo,1.2)
72+
```
73+
74+
In the same spirit, `constValueTuple[T <: Tuple]` is a tuple counterpart for `constValue`. For example:
75+
76+
```scala
77+
val result = constValueTuple["foo" *: "bar" *: 10 *: 2.5 *: EmptyTuple]
78+
println(result) // (foo,bar,10,2.5)
79+
```
80+
81+
This feature was introduced by PR [#9209](https://github.com/lampepfl/dotty/pull/9209).
82+
83+
# Per-run time budget for import suggestions
84+
Import suggestions is a feature useful for debugging but potentially taxing for performance. Therefore, we have added the `-Ximport-suggestion-timeout <time-in-ms>` to allow specifying the timeout (in milliseconds) after which the suggestions mechanism should stop the lookup. The timeout budget is per-run (and not per suggestion) which ensures that the performance does not degrade in case of too many suggestions.
85+
86+
# Let us know what you think!
87+
88+
If you have questions or any sort of feedback, feel free to send us a message on our
89+
[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please
90+
[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new).
91+
92+
## Contributing
93+
94+
Thank you to all the contributors who made this release possible 🎉
95+
96+
According to `git shortlog -sn --no-merges 0.25.0-RC2..0.26.0-RC1` these are:
97+
98+
```
99+
128 Martin Odersky
100+
53 Nicolas Stucki
101+
30 Sébastien Doeraene
102+
18 Anatolii Kmetiuk
103+
18 Guillaume Raffin
104+
17 Lan, Jian
105+
12 Guillaume Martres
106+
5 Aleksander Boruch-Gruszecki
107+
3 Ruslan Shevchenko
108+
3 odersky
109+
2 Alden Torres
110+
2 Robert Stoll
111+
2 yu-croco
112+
1 Alex Zolotko
113+
1 Kevin Dreßler
114+
1 FabioPinheiro
115+
1 adpi2
116+
1 Matthew Pickering
117+
1 Liu Fengyun
118+
```
119+
120+
If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved!
121+
Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html),
122+
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).
123+
They make perfect entry points into hacking on the compiler.
124+
125+
We are looking forward to having you join the team of contributors.
126+
127+
## Library authors: Join our community build
128+
129+
Dotty now has a set of widely-used community libraries that are built against every nightly Dotty
130+
snapshot. Currently, this includes shapeless, ScalaPB, algebra, scalatest, scopt and squants.
131+
Join our [community build](https://github.com/lampepfl/dotty/tree/master/community-build)
132+
to make sure that our regression suite includes your library.
133+
134+
[Scastie]: https://scastie.scala-lang.org/?target=dotty
135+
136+
[@odersky]: https://github.com/odersky
137+
[@DarkDimius]: https://github.com/DarkDimius
138+
[@smarter]: https://github.com/smarter
139+
[@felixmulder]: https://github.com/felixmulder
140+
[@nicolasstucki]: https://github.com/nicolasstucki
141+
[@liufengyun]: https://github.com/liufengyun
142+
[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain
143+
[@biboudis]: https://github.com/biboudis
144+
[@allanrenucci]: https://github.com/allanrenucci
145+
[@Blaisorblade]: https://github.com/Blaisorblade
146+
[@Duhemm]: https://github.com/Duhemm
147+
[@AleksanderBG]: https://github.com/AleksanderBG
148+
[@milessabin]: https://github.com/milessabin
149+
[@anatoliykmetyuk]: https://github.com/anatoliykmetyuk

docs/docs/reference/changed-features/structural-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ the database access example given at the beginning of this document.
128128
Local and anonymous classes that extend `Selectable` get more refined types
129129
than other classes. Here is an example:
130130
```scala
131-
class Vehicle extends reflect.Selectable {
131+
trait Vehicle extends reflect.Selectable {
132132
val wheels: Int
133133
}
134134
val i3 = new Vehicle { // i3: Vehicle { val range: Int }

0 commit comments

Comments
 (0)