Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hborla
Copy link
Member

@hborla hborla commented Jun 10, 2025

This syntax does not exist yet, and if you write ~Sendable, you'll get a compiler error that a conformance to Sendable cannot be suppressed. It's a good idea but it is neither pitched nor implemented.

This syntax does not exist yet. It's a good idea but it is neither
pitched nor implemented.
@hborla hborla requested a review from amartini51 June 10, 2025 15:27
@@ -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`:
Copy link
Member

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."

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

@amartini51 amartini51 left a 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`:
Copy link
Member

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.

Comment on lines 1587 to 1590
For more information about
suppressing an implicit conformance to a protocol,
see <doc:Protocols#Implicit-Conformance-to-a-Protocol>.

Copy link
Member

@amartini51 amartini51 Jun 16, 2025

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>.

@amartini51 amartini51 force-pushed the remove-sendable-suppression branch from cc94f30 to c4e7904 Compare June 16, 2025 21:52
@amartini51
Copy link
Member

amartini51 commented Jun 16, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants