Skip to content

Commit cbc8757

Browse files
Given -> Using mentioning
1 parent 52998e0 commit cbc8757

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/blog/_posts/2020-02-03-22nd-dotty-milestone-release.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ def f(x: Int)(given y: Int) = x * y
102102

103103
The above is a suboptimal solution, however. The feedback we received from the community suggested that many people felt like the `given` keyword was overused, similarly to the `implict` keyword in Scala 2. This overuse is one of the things we'd like to avoid in Scala 3. It leads, for example, to situations like `given (given ...)` which are not nice to read.
104104

105-
For this release, we have changed the syntax for the contextual parameters. The above snippet now becomes:
105+
For this release, we have changed the syntax for the contextual parameters. The keyword for the contextual argument group is now `using` instead of `given`. The above snippet now becomes:
106106

107107
```scala
108108
given String = "10"
109-
given with (str: String) : Int = str.toInt
110-
def f(x: Int) with (y: Int) = x * y
109+
given(using str: String) : Int = str.toInt
110+
def f(x: Int)(using y: Int) = x * y
111111
```
112112

113113
On the call site, the syntax for explicitly specifying the contextual parameters is now:
114114

115115
```scala
116-
f(2).with(20)
116+
f(2)(using 20)
117117
```
118118

119119
As opposed to the previous:
@@ -123,7 +123,7 @@ As opposed to the previous:
123123
f(2)(given 20)
124124
```
125125

126-
For the time being, the change is experimental and the old syntax is also supported. For the discussion, see [PR #8017](https://github.com/lampepfl/dotty/pull/8017). You can browse the documentation concerning the new syntax [here](https://dotty.epfl.ch/docs/reference/contextual/motivation-new.html).
126+
For the time being, the change is experimental and the old syntax is also supported. For the discussion, see [PR #8162](https://github.com/lampepfl/dotty/pull/8162). You can browse the documentation concerning the new syntax [here](https://dotty.epfl.ch/docs/reference/contextual/motivation-new.html).
127127

128128
# Semantics of inline parameters changed
129129
Inline parameters is a metaprogramming feature of Dotty which allows to splice the body of the parameter on its call site. Previously, inline parameters to methods were required to be known on compile time. With this release, this constraint has been relaxed. The following:

0 commit comments

Comments
 (0)