Sorry to double-post, but two thoughts on this section:
A closure can be explicitly specified to be isolated to a global actor by providing the attribute prior to the
in
in the closure specifier, e.g.,callback = { @MainActor in print($0) } callback = { @MainActor (i) in print(i) }
-
There's no formal grammar specification in the proposal, so it's not clear: if the closure has a capture list, does it come before or after the attribute? (I think I may have brought this up once on Twitter or something; it must have been lost in the shuffle.)
-
Can we extend this to other attributes that can be applied to closures, in addition to global actors? Result builders are the one that comes to mind immediately, but
@Sendable
and@escaping
might also be useful in niche situations. (Maybe we should sever this from the global actors proposal, though.)