Skip to content

Commit 0a52434

Browse files
authored
Merge pull request #12 from tegonal/doc-givens
doc(givens): mention thread safety
2 parents dd9504a + 00a3987 commit 0a52434

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/docs/reference/contextual/givens.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ a given for the type `Ord[Int]` whereas `listOrd[T]` defines givens
3434
for `Ord[List[T]]` for all types `T` that come with a given instance for `Ord[T]`
3535
themselves. The `using` clause in `listOrd` defines a condition: There must be a
3636
given of type `Ord[T]` for a given of type `List[Ord[T]]` to exist.
37-
Such conditions are expanded by the compiler to context
38-
parameters, which are explained in the [next section](./using-clauses.html).
37+
Such conditions are expanded by the compiler to [context
38+
parameters](./using-clauses.html).
3939

4040
## Anonymous Givens
4141

@@ -57,14 +57,16 @@ given global as ExecutionContext = new ForkJoinPool()
5757
This creates a given `global` of type `ExecutionContext` that resolves to the right
5858
hand side `new ForkJoinPool()`.
5959
The first time `global` is accessed, a new `ForkJoinPool` is created, which is then
60-
returned for this and all subsequent accesses to `global`.
60+
returned for this and all subsequent accesses to `global`. This operation is thread-safe.
6161

62-
Alias givens can be anonymous, e.g.
62+
Alias givens can be anonymous as well, e.g.
6363
```scala
6464
given Position = enclosingTree.position
6565
given (using outer: Context) as Context = outer.withOwner(currentOwner)
6666
```
67-
An alias given can have type parameters and implicit parameters just like any other given,
67+
<!-- TODO IMO the above example is very bad as the outer Context will always have precedence over the anonymous one. No? -->
68+
69+
An alias given can have type parameters and context parameters just like any other given,
6870
but it can only implement a single type.
6971

7072
## Given Whitebox Macro Instances

0 commit comments

Comments
 (0)