-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Gardening BackDeployConcurrency files #62504
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note here: These numbers need to be fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the old numbers were wrong. The list starts at 1, not a 0. |
||
/// | ||
/// for await number in Counter(howHigh: 10).dropFirst(3) { | ||
/// print("\(number) ", terminator: " ") | ||
/// print(number, terminator: " ") | ||
/// } | ||
/// // prints "4 5 6 7 8 9 10" | ||
/// // Prints "4 5 6 7 8 9 10 " | ||
/// | ||
/// If the number of elements to drop exceeds the number of elements in the | ||
/// sequence, the result is an empty sequence. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,18 +26,19 @@ import Swift | |
/// conforms to `AsyncIteratorProtocol`. The following example shows a `Counter` | ||
/// type that uses an inner iterator to monotonically generate `Int` values | ||
/// until reaching a `howHigh` value. While this example isn't itself | ||
/// asychronous, it shows the shape of a custom sequence and iterator, and how | ||
/// asynchronous, it shows the shape of a custom sequence and iterator, and how | ||
/// to use it as if it were asynchronous: | ||
/// | ||
/// struct Counter : AsyncSequence { | ||
/// struct Counter: AsyncSequence { | ||
/// typealias Element = Int | ||
/// let howHigh: Int | ||
/// | ||
/// struct AsyncIterator : AsyncIteratorProtocol { | ||
/// struct AsyncIterator: AsyncIteratorProtocol { | ||
/// let howHigh: Int | ||
/// var current = 1 | ||
/// | ||
/// mutating func next() async -> Int? { | ||
/// // A genuinely asychronous implementation uses the `Task` | ||
/// // A genuinely asynchronous implementation uses the `Task` | ||
/// // API to check for cancellation here and return early. | ||
/// guard current <= howHigh else { | ||
/// return nil | ||
|
@@ -56,10 +57,10 @@ import Swift | |
/// | ||
/// At the call site, this looks like: | ||
/// | ||
/// for await i in Counter(howHigh: 10) { | ||
/// print(i, terminator: " ") | ||
/// for await number in Counter(howHigh: 10) { | ||
/// print(number, terminator: " ") | ||
Comment on lines
+60
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I renamed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That looks like a good change to me. It's consistent, and "number" means more to the reader than "i". |
||
/// } | ||
/// // Prints: 1 2 3 4 5 6 7 8 9 10 | ||
/// // Prints "1 2 3 4 5 6 7 8 9 10 " | ||
/// | ||
/// ### End of Iteration | ||
/// | ||
|
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.
If you think this doesn't need to be rear-spaced, just let me know.
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 think including the quotes is an improvement. It makes it easier to see that the output from
print
includes a space at the end.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.
Good! I'll change
stdlib/public/Concurrency
files too and submit a new PR on the weekend. Thanks!