Skip to content

Commit 48774aa

Browse files
wip
1 parent a7f477c commit 48774aa

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authorImg: /images/anatolii.png
66
date: 2019-05-24
77
---
88

9-
Hi! In this article, we'd like to announce the 15th release of Dotty. With this release comes a bunch of improvements
9+
Hi! In this article, we'd like to announce the 15th release of Dotty. With this release comes a bunch of new features and improvements, such as the ability to enforce whether an operator is intended to be used in an infix position, the type safe pattern bindings and more.
1010

1111
This release serves as a technology preview that demonstrates new
1212
language features and the compiler supporting them.
@@ -27,12 +27,12 @@ You can learn more about Dotty on our [website](https://dotty.epfl.ch).
2727

2828
<!--more-->
2929

30-
This is our 14th scheduled release according to our
31-
[6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html).
30+
This is our 15th scheduled release according to our
31+
[6-week release schedule](https://dotty.epfl.ch/docs/contributing/release.html).
3232

3333
# What’s new in the 0.15.0-RC1 technology preview?
3434
## Operator Rules
35-
This change addresses the problem of the regulation of whether an operator is supposed to be used in an infix position. The motivation is for the library authors to be able to enforce whether a method or a type is supposed to be used in an infix position by the users.
35+
This change addresses the problem of the regulation of whether an operator is supposed to be used in an infix position. The motivation is for the library authors to be able to enforce whether a method or a type is supposed to be used in an infix position by the users. This ability will help to make code bases more consistent in the way the calls to methods are performed.
3636

3737
Methods with symbolic names like `+` are allowed to be used in an infix position by default:
3838

@@ -44,7 +44,7 @@ scala> Foo(1) + Foo(2)
4444
val res0: Int = 3
4545
```
4646

47-
Methods with alphanumeric names are not allowed to be used in an infix position by default. Breaking this constraint will raise a deprecation warning:
47+
Methods with alphanumeric names are not allowed to be used in an infix position. Breaking this constraint will raise a deprecation warning:
4848

4949
```scala
5050
scala> case class Foo(x: Int) { def plus(other: Foo) = x + other.x }
@@ -62,7 +62,7 @@ scala> Foo(1).plus(Foo(2))
6262
val res2: Int = 3
6363
```
6464

65-
As the warning says, if you want the users of your library to be able to use it in an infix position, you can do so as follows:
65+
As the warning says, if you want the users of the method to be able to use it in an infix position, you can do so as follows:
6666

6767
```scala
6868
scala> import scala.annotation.infix
@@ -74,11 +74,9 @@ scala> Foo(1) plus Foo(2)
7474
val res3: Int = 3
7575
```
7676

77-
The above change will allow for more consistency across the code base, as the author of a method is able to make a decision on how the method is supposed to be called.
78-
7977
To smoothen the migration, the deprecation warnings will only be emitted if you compile with the `-strict` flag under Dotty 3. Alphanumeric methods that are defined without the `@infix` annotation used in an infix position will be deprecated by default starting with Dotty 3.1.
8078

81-
For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/operators.html#the-infix-annotation). Note that the `@alpha` annotation also described in the documentation is a work in progress and is not available in this release.
79+
For more information, see the the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/operators.html#the-infix-annotation). Note that the `@alpha` annotation also described in the documentation is planned for the future and is not available in this release.
8280

8381
## `given` clause comes last
8482
In the previous release, you could write something like this:
@@ -99,15 +97,15 @@ Now, however, `given` clauses must come last. The above code will fail with:
9997
one error found
10098
```
10199

102-
The following code is the correct way to express the program in question:
100+
The following snippet is the correct way to express the program in question:
103101

104102
```scala
105103
implied for String = "foo"
106104
def f(x: Int)(z: Int) given (y: String) = x + z
107105
f(1)(3)
108106
```
109107

110-
This change is done to reduce confusion when calling functions with mixed explicit and implied parameters.
108+
We changed this to reduce confusion when calling functions with mixed explicit and implied parameters.
111109

112110
## Type-safe Pattern Bindings
113111
```scala
@@ -128,10 +126,8 @@ Dotty compiler will allow such a pattern binding only if the pattern is *irrefut
128126
If we want to force the pattern binding if the pattern is not irrefutable, we can do so with an annotation:
129127

130128
```scala
131-
scala> val xs: List[Any] = List("1", "2", "3")
132-
| val (x: String) :: _: @unchecked = xs
133-
val x: String = 1
134-
val xs: List[Any] = List(1, 2, 3)
129+
val xs: List[Any] = List("1", "2", "3")
130+
val (x: String) :: _: @unchecked = xs
135131
```
136132

137133
The same is implemented for pattern bindings in `for` expressions:
@@ -142,12 +138,12 @@ The same is implemented for pattern bindings in `for` expressions:
142138
// than the right hand side expression's type Any
143139
```
144140

145-
For the migration purposes, the above change will only take effect in Dotty 3.1 by default. You can use it from Dotty 3 with the `-strict` flag.
141+
For the migration purposes, the above change will only take effect in Dotty 3.1. You can use it in Dotty 3 with the `-strict` flag.
146142

147143
For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html).
148144

149-
## Further improvements to GADT support
150-
In this release, we've further improved our support for Generalised Algebraic Data Types (GADTs). Most notably, we now support variant GADTs:
145+
## Further improvements to Generalised Algebraic Data Types (GADTs) support
146+
In this release, we've further improved our support for GADTs. Most notably, we now support variant GADTs:
151147

152148
```scala
153149
enum Expr[+T] {

0 commit comments

Comments
 (0)