-
Notifications
You must be signed in to change notification settings - Fork 186
Remove the mention of ~Sendable
from the concurrency chapter.
#373
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
base: main
Are you sure you want to change the base?
Conversation
This syntax does not exist yet. It's a good idea but it is neither pitched nor implemented.
@@ -1568,12 +1568,15 @@ struct TemperatureReading { | |||
--> | |||
|
|||
To explicitly mark a type as not being sendable, | |||
write `~Sendable` after the type: | |||
write an unavailable conformance 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 correct to describe using the availability annotation as an unavailable conformance? If there's not a ~Sendable
, then I might suggest using a phrasing like:
"mark the Sendable conformance as unavailable."
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've always used the term "unavailable conformance" for this. What I don't like about "mark the Sendable conformance as unavailable" is that it doesn't tell you that you need to actually add the conformance and then mark it as unavailable. I personally prefer the existing wording. Curious what @amartini51 thinks.
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 prefer the term "unavailable conformance", which I think is more descriptive. The extension adds conformance to the Sendable
protocol, and the @available
attribute marks the conformance as unavailable.
For comparison/precedent, the Protocols chapter describes the same syntax in its example as:
Another way to suppress implicit conformance is with an extension that you mark as unavailable:
And it uses the wording "suppress an implicit conformance" for the ~Protocol
syntax.
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.
Thanks for catching & fixing this issue, Holly!
@@ -1568,12 +1568,15 @@ struct TemperatureReading { | |||
--> | |||
|
|||
To explicitly mark a type as not being sendable, | |||
write `~Sendable` after the type: | |||
write an unavailable conformance 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 prefer the term "unavailable conformance", which I think is more descriptive. The extension adds conformance to the Sendable
protocol, and the @available
attribute marks the conformance as unavailable.
For comparison/precedent, the Protocols chapter describes the same syntax in its example as:
Another way to suppress implicit conformance is with an extension that you mark as unavailable:
And it uses the wording "suppress an implicit conformance" for the ~Protocol
syntax.
For more information about | ||
suppressing an implicit conformance to a protocol, | ||
see <doc:Protocols#Implicit-Conformance-to-a-Protocol>. | ||
|
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.
We might want to keep some form of cross-reference here, since the Protocols chapter contrasts the ~Protocol
syntax with this syntax. Added in 9056504 as a starting point:
You can also use an unavailable conformance
to suppress implicit conformance to a protocol,
as discussed in <doc:Protocols#Implicit-Conformance-to-a-Protocol>.
cc94f30
to
c4e7904
Compare
Please excuse the force-push. I added the cross reference back in the wrong spot, which caused a merge conflict. Putting it in the right spot instead is cleaner that handling the conflict, and produces a better diff for review here. |
This syntax does not exist yet, and if you write
~Sendable
, you'll get a compiler error that a conformance toSendable
cannot be suppressed. It's a good idea but it is neither pitched nor implemented.