Skip to content

Commit 1de50f6

Browse files
committed
Update cc.md
1 parent 0817e43 commit 1de50f6

File tree

1 file changed

+10
-3
lines changed
  • docs/_docs/reference/experimental

1 file changed

+10
-3
lines changed

Diff for: docs/_docs/reference/experimental/cc.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -737,15 +737,22 @@ The type variable `cap X` (with `cap` being a soft modifier) can be instantiated
737737
we see a variable `listeners` that has as type a `Set` of `Listeners` capturing `X`. The `register` method takes a listener of this type
738738
and assigns it to the variable.
739739

740-
Capture-set variables `cap X` are represented as regular type variables within the special interval
741-
`>: CapSet <: CapSet^`. For instance, `Source` could be equivalently
740+
Capture-set variables `cap X` without user-annotated bounds by default range over the interval `>: {} <: {caps.cap}` which is the universe of capture sets instead of regular types.
741+
742+
Under the hood, such capture-set variables are represented as regular type variables within the special interval
743+
`>: CapSet <: CapSet^`.
744+
For instance, `Source` from above could be equivalently
742745
defined as follows:
743746
```scala
744747
class Source[X >: CapSet <: CapSet^]:
745748
...
746749
```
747750
`CapSet` is a sealed trait in the `caps` object. It cannot be instantiated or inherited, so its only
748-
purpose is to identify capture-set type variables and types. This representation based on `CapSet` is subject to change and
751+
purpose is to identify type variables which are capture sets. In non-capture-checked
752+
usage contexts, the type system will treat `CapSet^{a}` and `CapSet^{a,b}` as the type `CapSet`, whereas
753+
with capture checking enabled, it will take the annotated capture sets into account,
754+
so that `CapSet^{a}` and `CapSet^{a,b}` are distinct.
755+
This representation based on `CapSet` is subject to change and
749756
its direct use is discouraged.
750757

751758
Capture-set variables can be inferred like regular type variables. When they should be instantiated

0 commit comments

Comments
 (0)