Open
Conversation
e2315b0 to
ef0d6b2
Compare
ef0d6b2 to
16e9bf0
Compare
Joannis
reviewed
Feb 16, 2024
proposals/nnnn-closure-isolation.md
Outdated
| ```swift | ||
| actor A { | ||
| func isolate() { | ||
| Task { [isolated self] in |
Member
There was a problem hiding this comment.
Does this imply the following scenarios?
func isolate(on otherActor: some AnyActor) {
Task { [isolated otherActor] in
// Valid
}
}func isolate(on otherActor: some AnyActor) {
Task { [isolated otherActor] in
self.bool.toggle() // Fails compilation because `otherActor` isolation does not match `self`'s isolation
}
}protocol Toggleable {
func toggle()
}
func isolate(on otherActor: some AnyActor & Toggleable) {
Task { [isolated otherActor] in
otherActor.toggle() // Successful, because this Task is isolated to `otherActor`'s isolation
}
}
Contributor
Author
There was a problem hiding this comment.
(Let me preface by saying that this proposal isn't fully baked yet, hence not having been pitched or added anyone to the PR yet.)
The first example, it is unclear to me what is "valid" given that the body of the closure does not do anything? But the syntax for the isolation capture is valid, and the capture will be isolated to otherActor.
The second example correct will fail.
The third example yes correct as well.
8b0dde7 to
54c1550
Compare
54c1550 to
7e4d540
Compare
ktoso
approved these changes
Feb 29, 2024
f926a22 to
0fb068e
Compare
…ses when used with parameters
…atibility" section
Some typos and a few small wording changes
|
|
||
| class New { | ||
| public init(@inheritsIsolation operation: () async) | ||
| } |
Contributor
There was a problem hiding this comment.
These two examples both have a tiny typo in them. They are missing a -> Void.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.