Skip to content
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

Fix ambiguous phrasing in 8.2.13 in paragraph on closure traits #991

Closed
wants to merge 1 commit into from

Conversation

mcclure
Copy link
Contributor

@mcclure mcclure commented Mar 25, 2021

Addresses #983.

8.2.13 contains a paragraph of three sentences, in which the first sentence talks about the set of all closure traits, the second sentence talks about the specific closure traits send and sync, and the third sentence uses the phrase "these traits". In the third sentence it is unclear if the referent of "these traits" is closure traits (first sentence), the specific closure traits described in the second sentence, or nothing at all (IE it could mean "these characteristics" in the informal English sense).

This patch clarifies the text so that it is totally clear the two traits in sentence two are a subset of closure traits and totally clear that "these traits" in sentence three refers to "closure traits". I didn't get any answers in #983 but that is my best reasonable guess what the text means. Obviously only merge this if this is actually the text's intent…!

Comment on lines +34 to +35
The closure will also implement the closure traits [`Send`](../special-types-and-traits.md#send) and/or [`Sync`](../special-types-and-traits.md#sync) if all of its captured types do.
Closure traits allow functions to accept closures using generics, even though the exact types can't be named.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't add "the closure traits" for Send/Sync. "Closure traits" specifically refers to Fn, FnMut, and FnOnce. The other traits that closures may implement (send/sync/copy/clone) are just extras, and are not directly related to allowing use as function parameters.

I'm not sure why they are even called closure traits, since they are just the general call traits which are used for things other than closures. And I also question why it explicitly says "using generics", since closures can also be passed as trait objects.

Since the closure type chapter uses a clearer term ("call traits"), I would change it to use that phrasing, and change the last sentence to something like "The call traits allow functions to accept closures as parameters, even though…".

@ehuss
Copy link
Contributor

ehuss commented Mar 28, 2021

Oh, I forgot. This will be rewritten as part of #967. Perhaps you could take a look at that PR and see if it is clearer there?

@ehuss ehuss added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Apr 4, 2021
@ehuss
Copy link
Contributor

ehuss commented Jan 30, 2022

I'm going to close this since this section has been rewritten, which I think has a bit clearer wording.

@ehuss ehuss closed this Jan 30, 2022
@mcclure
Copy link
Contributor Author

mcclure commented Jan 31, 2022

Sorry I failed to respond before, and thanks for clarifying the text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants