Skip to content

Commit 669f1d1

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ func test() {
4848
}
4949
```
5050

51-
In the above code, the closure is global-actor-isolated, so it cannot be called concurrently. The compiler should be able to infer the `@Sendable` attribute. Because of the same reason, globally isolated closures should be allowed to capture non-`Sendable` values.
51+
Requiring both a global actor attribute and `@Sendable` creates an unfortunate pile-up of attributes, and it would be better for Swift to just infer `@Sendable` from the global actor attribute.
52+
53+
Because a globally-isolated closure cannot be called concurrently, it's safe for it to capture non-`Sendable` values even if it's implicitly `@Sendable`. Such values just need to be transferred to the global actor's region (if they aren't there already). This also applies to closures that are isolated to a specific actor reference.
5254

5355

5456
Finally, the current diagnostic for a global-actor-isolated subclass of a non-isolated superclass is too restrictive:

0 commit comments

Comments
 (0)