Skip to content

Commit 743c072

Browse files
simanerushrjmccall
andauthored
Update proposals/NNNN-global-actor-isolated-types-usability.md
Co-authored-by: John McCall <[email protected]>
1 parent beca5b3 commit 743c072

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

proposals/NNNN-global-actor-isolated-types-usability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func test(globallyIsolated: @escaping @MainActor () -> Void) {
138138
}
139139
```
140140

141-
The `globallyIsolated` closure in the above code is global-actor isolated via the `@MainActor`. Thus, it can never operate on the same reference concurrently at the same time, making it safe to be invoked from different isolation domains. This means that for such global-actor-isolated closures and functions, the `@Sendable` attribute is implicit.
141+
The `globallyIsolated` closure in the above code is global-actor isolated because it has the `@MainActor` attribute. Because it will always run isolated, it's fine for it to capture and use values that are isolated the same way. It's also safe to share it with other isolation domains because the captured values are never directly exposed to those isolation domains. This means that there's no reason not to always treat these functions as `@Sendable`.
142142

143143
#### Non-`Sendable` captures in isolated closures
144144

0 commit comments

Comments
 (0)