Skip to content

[Concurrency] Revise Async- related files doc #58930

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

Merged
merged 2 commits into from
May 23, 2022

Conversation

Jager-yoo
Copy link
Contributor

  • Revise // Prints comments style like the other stdlib files.
  • Remove verbose string interpolations and extra spaces to be read more clearly.
    • (e.g.)
    - print ("\(error)")
    + print(error)
  • Remove some unneeded parentheses.
    • (e.g.)
    - if (random % 5 == 0) { ... }
    + if random % 5 == 0 { ... }
  • Replace the majority of ' : ' with ': '
  • Fix wrong indentation
  • Keep files with a single empty line at the end

- Revise '// Prints' comments style like the other stdlib files
- Remove verbose string interpolations and extra spaces
- Remove some unneeded parentheses
- Replace the majority of ' : ' with ': '
- Fix wrong indentation
- Keep files with a single empty line at the end
@Jager-yoo Jager-yoo force-pushed the revise-concurrency-doc branch 2 times, most recently from 4fc5bda to b9bbe62 Compare May 17, 2022 08:06
@Jager-yoo
Copy link
Contributor Author

Jager-yoo commented May 19, 2022

Hi, @invalidname, @phausler, @bjlanier!
Could one of you guys please review my change proposals?
Cause most of the changes are related to your previous PR #37383 on 14 May 2021.

@phausler
Copy link
Contributor

Overall the changes look sound to me. I defer to the folks doing documentation publishing for style guidance.

@Jager-yoo
Copy link
Contributor Author

Really appreciate it! 👍🏻

Copy link
Contributor

@invalidname invalidname left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for these corrections.

/// return Int.random(in: 1...10)
/// }
/// onCancel: { @Sendable () in print ("Canceled.") }
/// )
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice job catching this stray ) that shouldn't be there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! 😄
Note that I also edited the word "Canceled." → "Cancelled." (double l)

Copy link
Member

@amartini51 amartini51 May 23, 2022

Choose a reason for hiding this comment

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

"Canceled" was correct — please change this back.

Documentation follows Apple Style Guide, which calls for spelling it "canceled" and "canceling". The API naming guidelines for Cocoa (which Swift often follows) follow historical precedent of other API names, and spells it "cancelled" and "cancelling".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amartini51 Thanks for following up!
The Apple Style Guide - C definitely says that we should use one l for "canceled".

On lines 121-122 in the very same file, however, there is case cancelled in use.

/// The stream finished as a result of cancellation.
case cancelled

Actually, "cancelled" is being used much more than "canceled" in overall Swift repo. 🧐
Would it be better to just revert this word for now? How do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Let's revert this change please, so we're not making the problem worse. Someone (possibly me or @invalidname) can take another pass over the file to correct the other "cancelled" spellings in a different PR.

Copy link
Member

Choose a reason for hiding this comment

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

Regarding lines 121-121, case cancelled is an example of the Cocoa naming guidelines I mentioned. You can see this style difference in API reference for Task and and related types — symbols with "cancelled" in its name have "canceled" in their docs.

Both style guides use the spelling "cancellation".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh, now I see. Documentation follows "canceled", while the API naming follows "cancelled".
Sorry for additional revert commit, and thank you so much for being part of this.

Copy link
Member

Choose a reason for hiding this comment

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

Reading my original post, I could have been clearer that there were two style guides involved here, one for code and one for docs. Sorry about that. Thanks for the fixes in this PR!

@@ -22,12 +22,12 @@ extension AsyncSequence {
///
/// In this example, an asynchronous sequence called `Counter` produces `Int`
/// values from `1` to `10`. The `dropFirst(_:)` method causes the modified
/// sequence to ignore the values `0` through `4`, and instead emit `5` through `10`:
/// sequence to ignore the values `1` through `3`, and instead emit `4` through `10`:
Copy link
Contributor

Choose a reason for hiding this comment

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

Right. This way matches the actual output on line 30.

@Jager-yoo
Copy link
Contributor Author

Thanks for reviewing, @invalidname!
Could you ask @swift-ci to smoke test and merge this? Or should I ask someone else?

@amartini51
Copy link
Member

@swift-ci Please smoke test.

@amartini51 amartini51 merged commit 4b0824c into swiftlang:main May 23, 2022
@Jager-yoo Jager-yoo deleted the revise-concurrency-doc branch May 24, 2022 02:17
amartini51 added a commit to amartini51/swift that referenced this pull request May 26, 2022
[Concurrency] Revise `Async-` related files doc

(cherry picked from commit 4b0824c)
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.

4 participants