Skip to content

Commit 0a31784

Browse files
DougGregorxwu
andauthored
Global-actor isolated conformances (#2720)
* Draft: isolated conformances * Add an introduction, switch to `isolated P` syntax * Turn this into a real proposal with introduction / motivation / etc Also pull in Slava's lovely idea of the SendableMetatype protocol, and narrow the "strict sendable metatypes" check to type parameters that have non-marker protocol requirements. * Future work entry for non-isolated types with isolated conformances * Future direction: consider inference of `isolated` along with `@MainActor` * Add alternative considered for isolated conformance requirements * Discuss using "non-Sendable" terminology instead of "isolated conformances" * [Isolated conformances] Note the need for `nonisolated` if we infer `isolated` * [Isolated conformances] Add alternative for the "@mainactor P" spelling Instead of using `isolated P` for an isolated conformance, we could use the global actor spelling. Document it. * [Isolated conformances] Remove some leftover text This was rewritten and moved in an earlier iteration. * [Isolated conformances] Switch to @GlobalActorName spelling I've gotten a bunch of feedback that `isolated P` is confusing, and `@MainActor P` is both clearer and more extensible. Rework the proposal to use this new syntax, and bring in a few future directions that are enabled by it. * Now that SE-0466 is in review, promote "infer @mainactor conformances" This was in future work, but make this an official part of the proposal now that SE-0466 is in review. * Fix a few inconsistencies and odd wording choices * Introduce a second necessary restriction on dynamic casting Thanks to John for noticing that we need this dynamic check as well. * Add a "Future Direction" for inferring global actor isolation more generally * Address PR comments, thank you Xiaodi! * Add key path example * Improve exposition of rule (2) Instead of solely talking about the metatype being Sendable, be explicit about the two halves of type checking for generic code and what they mean for isolated conformances, how Sendable changes the interface contract, and why we slip SendableMetatype in there. * Bring the upcoming feature InferIsolatedConformances into the proposal * Fix a sentence fragment * Assign SE-0470 --------- Co-authored-by: Xiaodi Wu <[email protected]>
1 parent 5864640 commit 0a31784

File tree

1 file changed

+662
-0
lines changed

1 file changed

+662
-0
lines changed

0 commit comments

Comments
 (0)