-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Decopose Mutable #24495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Decopose Mutable #24495
Conversation
docs/_docs/reference/experimental/capture-checking/mutability.md
Outdated
Show resolved
Hide resolved
| r | ||
| ``` | ||
| Here, `r` is a fresh reference of type `Ref[String]` that escapes the scope of `withFile`. That's OK only since | ||
| `Ref` is classified as `Unscoped`. Since `Unscoped` is a [classifier](./classifiers.md) it means that `Ref` cannot possibly capture `f`, which as a `File` is not classified as `Unscoped`. So returning a `Ref` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a scoped capability capture an unscoped capability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the Ref need to be fresh to be allowed to be captured by the value returned from op?
For example, suppose we changed the signature of withFile to:
def withFile[T](op: (f: File^, r: Ref[String]^) => T): T =Could we then call it with an op whose result type captures r?
docs/_docs/reference/experimental/capture-checking/mutability.md
Outdated
Show resolved
Hide resolved
docs/_docs/reference/experimental/capture-checking/mutability.md
Outdated
Show resolved
Hide resolved
Also: drop redundant statement in captureSetImpliedByFields
Still missing: Make Mutable an Unscoped
Fix: the APPLY rule had to be changed so that it does not kick in if the result has Unscoped capabilities. These need to be preserved, we cannot approximate by the (possibly pure) function type.
First commit: New doc page for decomposed mutables
Todo: