Skip to content

Commit f397165

Browse files
committed
Address review comments
1 parent 5f37755 commit f397165

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

docs/docs/reference/contextual/inferable-params.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: doc-page
33
title: "Inferable Parameters"
44
---
55

6-
Functional programming tends to express most dependencies as simple functions parameterization.
6+
Functional programming tends to express most dependencies as simple function parameterization.
77
This is clean and powerful, but it sometimes leads to functions that take many parameters and
88
call trees where the same value is passed over and over again in long call chains to many
99
functions. Inferable parameters can help here since they enable the compiler to synthesize

docs/docs/reference/contextual/instance-defs.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ implied ListOrd[T] given (ord: Ord[T]) for Ord[List[T]] {
3030
}
3131
```
3232
This code defines a trait `Ord` and two implied instance definitions. `IntOrd` defines
33-
an implied instance for the type `Ord[Int]` whereas `ListOrd` defines implied
34-
instances of `Ord[List[T]]` for all types `T` that come with an implied `Ord` instance themselves.
35-
The `given` clause in `ListOrd` defines an [inferable parameter](./inferable-params.html).
33+
an implied instance for the type `Ord[Int]` whereas `ListOrd[T]` defines implied
34+
instances of `Ord[List[T]]` for all types `T` that come with an implied `Ord[T]` instance themselves.
35+
The `given` clause in `ListOrd` defines an [inferable parameter](./inferable-params.html).
3636
Inferable parameters are further explained in the next section.
3737

3838
## Anonymous Implied Instances
@@ -48,13 +48,11 @@ the type(s) in the `for` clause.
4848

4949
## Implied Alias Instances
5050

51-
An implied alias instance defines an implied instance that is equal to some expression. E.g.,
51+
An implied alias instance defines an implied instance that is equal to some expression. E.g., assuming a global method `currentThreadPool` returning a value with a member `context`, one could define:
5252
```scala
5353
implied ctx for ExecutionContext = currentThreadPool().context
5454
```
55-
Here, we create an implied instance `ctx` of type `ExecutionContext` that resolves to the
56-
right hand side `currentThreadPool().context`. Each time an implied instance of `ExecutionContext`
57-
is demanded, the result of evaluating the right-hand side expression is returned.
55+
This creates an implied instance `ctx` of type `ExecutionContext` that resolves to the right hand side `currentThreadPool().context`. Each time an implied instance of `ExecutionContext` is demanded, the result of evaluating the right-hand side expression is returned.
5856

5957
Alias instances may be anonymous, e.g.
6058
```scala

docs/docs/reference/contextual/query-types-spec.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ the inferable parameters `xi`.
4242

4343
The query literal is evaluated as the instance creation
4444
expression:
45-
46-
new scala.ImplicitFunctionN[T1, ..., Tn, T] {
47-
def apply given (x1: T1, ..., xn: Tn): T = e
48-
}
49-
45+
```scala
46+
new scala.ImplicitFunctionN[T1, ..., Tn, T] {
47+
def apply given (x1: T1, ..., xn: Tn): T = e
48+
}
49+
```
5050
In the case of a single untyped parameter, `given (x) => e` can be
5151
abbreviated to `given x => e`.
5252

docs/docs/reference/contextual/query-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ With that setup, the table construction code above compiles and expands to:
112112
```
113113
### Example: Postconditions
114114

115-
As a larger example, here is a way to define constructs for checking arbitrary postconditions using `ensuring` so that the checked result can be referred to simply by `result`. The example combines opaque aliases, context query types, and extension methods to provide a zero-overhead abstraction.
115+
As a larger example, here is a way to define constructs for checking arbitrary postconditions using an extension method `ensuring`so that the checked result can be referred to simply by `result`. The example combines opaque aliases, context query types, and extension methods to provide a zero-overhead abstraction.
116116

117117
```scala
118118
object PostConditions {

docs/docs/reference/contextual/relationship-implicits.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ The `infer` method corresponds to `implicitly` in Scala 2.
8282
Context bounds are the same in both language versions. They expand to the respective forms of implicit parameters.
8383

8484
**Note:** To ease migration, context bounds in Dotty map for a limited time to old-style implicit parameters for which arguments can be passed either with `given` or
85-
with a normal application.
85+
with a normal application. Once old-style implicits are deprecated, context bounds
86+
will map to inferable parameters instead.
8687

8788
### Extension Methods
8889

0 commit comments

Comments
 (0)