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/contextual-instance/import-implied.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ object B {
18
18
In the code above, the `import A._` clause of object `B` will import all members
19
19
of `A`_except_ the instance `tc`. Conversely, the second import `import instance A._` will import _only_ that instance.
20
20
21
-
Generally, a normal import clause brings all members except implicit instance values into scope whereas an `import instance` clause brings only implicit instance values into scope.
21
+
Generally, a normal import clause brings all members except implicit instances into scope whereas an `import instance` clause brings only implicit instances into scope.
22
22
23
23
There are two main benefits arising from these rules:
24
24
@@ -32,22 +32,22 @@ There are two main benefits arising from these rules:
32
32
33
33
### Relationship with Old-Style Implicits
34
34
35
-
The rules of evidence imports above have the consequence that a library
35
+
The rules of instance imports above have the consequence that a library
36
36
would have to migrate in lockstep with all its users from old style implicit definitions and
37
-
normal imports to evidence definitions and evidence imports.
37
+
normal imports to instance definitions and instance imports.
38
38
39
39
The following modifications avoid this hurdle to migration.
40
40
41
-
1. An evidence import also brings old style implicits into scope. So, in Scala 3.0
41
+
1. An instance import also brings old style implicits into scope. So, in Scala 3.0
42
42
an old-style implicit definition can be brought into scope either by a normal or
43
-
by an evidence import.
43
+
by an instance import.
44
44
45
45
2. In Scala 3.1, an old-style implicits accessed implicitly through a normal import
46
46
will give a deprecation warning.
47
47
48
48
3. In some version after 3.1, an old-style implicits accessed implicitly through a normal import
49
49
will give a compiler error.
50
50
51
-
These rules mean that library users can use `import evidence` to access old-style implicits in Scala 3.0,
51
+
These rules mean that library users can use `import instance` to access old-style implicits in Scala 3.0,
52
52
and will be gently nudged and then forced to do so in later versions. Libraries can then switch to
53
-
evidence definitions once their user base has migrated.
53
+
instance definitions once their user base has migrated.
Copy file name to clipboardExpand all lines: docs/docs/reference/contextual-instance/instance-defs.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,9 @@ instance [T] given (ord: Ord[T]) of Ord[List[T]] { ... }
46
46
```
47
47
If a name is not given, the compiler will synthesize one from the type(s) in the `for` clause.
48
48
49
-
## instance Aliases
49
+
## Alias Instances
50
50
51
-
An instance alias defines an implicit instance that is equal to some expression. E.g., assuming a global method `currentThreadPool` returning a value with a member `context`, one could define:
51
+
An alias instance defines an implicit instance that is equal to some expression. E.g., assuming a global method `currentThreadPool` returning a value with a member `context`, one could define:
52
52
```scala
53
53
instance ctx of ExecutionContext= currentThreadPool().context
54
54
```
@@ -59,7 +59,7 @@ Alias instances may be anonymous, e.g.
59
59
```scala
60
60
instance of Position= enclosingTree.position
61
61
```
62
-
An instance alias can have type and context parameters just like any other instance definition, but it can only implement a single type.
62
+
An alias instance can have type and context parameters just like any other instance definition, but it can only implement a single type.
0 commit comments