You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/reference/instances/context-params.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
layout: doc-page
3
-
title: "Implicit Parameters and Arguments"
3
+
title: "Inferred Parameters and Arguments"
4
4
---
5
5
6
6
A new syntax for implicit parameters aligns definition and call syntax. Parameter definitions and method arguments both follow a `given` keyword. On the definition side, the old syntax
Then the following calls are all valid (and normalize to the last one)
61
61
```scala
@@ -69,7 +69,7 @@ or as a sequence of types. To distinguish the two, a leading `(` always indicate
69
69
70
70
## Summoning an Instance
71
71
72
-
A method `summon` in `Predef`creates an implicit instance value for a given type, analogously to what `implicitly[T]` did. The only difference between the two is that
72
+
A method `summon` in `Predef`returns the inferred value for a given type, analogously to what `implicitly[T]` did. The only difference between the two is that
73
73
`summon` takes a context parameter, where `implicitly` took an old-style implicit parameter:
Instances can also be defined without an `of` clause. A typical application is to use a instance to package some extension methods. Examples:
58
+
Inferred instances can also be defined without a `for` clause. A typical application is to use an inferred instance to package some extension methods. Examples:
An alias instance creates an instance that is equal to some expression. E.g.,
178
+
An inferred alias instance creates an inferred instance that is equal to
179
+
some expression. E.g.,
178
180
```
179
-
instance ctx of ExecutionContext = currentThreadPool().context
181
+
inferred ctx for ExecutionContext = currentThreadPool().context
180
182
```
181
-
Here, we create an instance `ctx` of type `ExecutionContext` that resolves to the
182
-
right hand side `currentThreadPool().context`. Each time an instance of `ExecutionContext`
183
+
Here, we create an inferred instance `ctx` of type `ExecutionContext` that resolves to the
184
+
right hand side `currentThreadPool().context`. Each time an inferred instance of `ExecutionContext`
183
185
is demanded, the result of evaluating the right-hand side expression is returned. The instance definition is equivalent to the following implicit definition:
184
186
```
185
187
final implicit def ctx: ExecutionContext = currentThreadPool().context
186
188
```
187
189
Alias instances may be anonymous, e.g.
188
190
```
189
-
instance of Position = enclosingTree.position
191
+
inferred for Position = enclosingTree.position
190
192
```
191
-
An alias instance can have type and context parameters just like any other instance definition, but it can only implement a single type.
193
+
An inferred alias instance can have type and context parameters just like any other inferred instance definition, but it can only implement a single type.
192
194
193
195
## Syntax
194
196
195
-
Here is the new syntax of instance definitions, seen as a delta from the [standard context free syntax of Scala 3](http://dotty.epfl.ch/docs/internals/syntax.html).
197
+
Here is the new syntax of inferred instance definitions, seen as a delta from the [standard context free syntax of Scala 3](http://dotty.epfl.ch/docs/internals/syntax.html).
0 commit comments