-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add reference page for Sendable protocol. #42128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci Please smoke test. |
/// | ||
/// To satisfy the requirements of the `Sendable` protocol, | ||
/// all of the elements of the tuple must be sendable. | ||
/// Tuples that satisfy the requirements implicitly conform to `Sendable`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth mentioning the other odd case, that metatypes (e.g., Int.Type
) are implicitly Sendable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? I'm trying to tease out what facts about "sendable" the language concept belong in TSPL, versus the facts about Sendable
the protocol that belong here. I was planning to talk about metatypes in TSPL, since you can't write something like Int.Type: Sendable
. However, it sounds like that discussion belongs here, because the conformance is implicit like several other things that implicitly conform to Sendable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in c9bdda9.
stdlib/public/core/Sendable.swift
Outdated
/// | ||
/// ### Sendable Actors and Classes | ||
/// | ||
/// All actor types implicitly conform to `Sendable`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend leading with a sentence or two stating why we get implicit Sendable conformances, because it'll be informative and help with the "classes" section. Here's one idea:
/// All actor types implicitly conform to `Sendable`. | |
/// Actor types are reference types where each instance is its own concurrency domain. The actor ensures that all accesses to its mutable state are performed sequentially. Therefore, all actor types implicitly conform to `Sendable`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 32e0825:
All actor types implicitly conform to
Sendable
because actors ensure that all access to their mutable state is performed sequentially.
Co-authored-by: Doug Gregor <[email protected]>
Co-authored-by: Doug Gregor <[email protected]>
Co-authored-by: Doug Gregor <[email protected]>
@DougGregor Thanks for the review! Do the changes from today resolve the issues you highlighted? |
@swift-ci Please smoke test |
Co-authored-by: Brian Lanier <[email protected]>
@swift-ci Please smoke test and merge. |
1 similar comment
@swift-ci Please smoke test and merge. |
Resolves rdar://87221356