You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Guides/BufferedBytes.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -40,13 +40,13 @@ public struct AsyncBufferedByteIterator: AsyncIteratorProtocol, Sendable {
40
40
}
41
41
```
42
42
43
-
For each invocation of `next` the iterator will check if a buffer has been filled. If the buffer is filled with some amount of bytes a fast path is taken to directly return a byte out of that buffer. If the buffer is not filled then the read function is invoked to acquire the next filled buffer and then it takes a byte out of that buffer.
43
+
For each invocation of `next`, the iterator will check if a buffer has been filled. If the buffer is filled with some amount of bytes, a fast path is taken to directly return a byte out of that buffer. If the buffer is not filled, the read function is invoked to acquire the next filled buffer, at which point it takes a byte out of that buffer.
44
44
45
-
If the read function returns 0 indicating it read no more bytes the iterator is claimed to be finished and no additional invocations to the read function are made.
45
+
If the read function returns `0`, indicating it didn't read any more bytes, the iterator is decided to be finished and no additional invocations to the read function are made.
46
46
47
-
If the read function throws the error will be thrown by the iteration. Subsequent invocations to the iterator will return nil without invoking the read function.
47
+
If the read function throws, the error will be thrown by the iteration. Subsequent invocations to the iterator will then return `nil` without invoking the read function.
48
48
49
-
During the iteration if the task is cancelled the iterationwill check the cancellation only in passes where the read function is invoked and will throw a `CancellationError`.
49
+
If the task is cancelled during the iteration, the iteration will check the cancellation only in passes where the read function is invoked, and will throw a `CancellationError`.
Copy file name to clipboardExpand all lines: Guides/Chain.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -20,11 +20,11 @@ for try await line in lines {
20
20
}
21
21
```
22
22
23
-
The above example shows how two `AsyncSequence` types can be chained together. In this case it prepends a preamble to the lines content of the file.
23
+
The above example shows how two `AsyncSequence` types can be chained together. In this case it prepends a preamble to the `lines` content of the file.
24
24
25
25
## Detailed Design
26
26
27
-
This function family and the associated family of return types are prime candidates for variadic generics. Until that proposal is accepted these will be implemented in terms of two and threebase sequence cases.
27
+
This function family and the associated family of return types are prime candidates for variadic generics. Until that proposal is accepted, these will be implemented in terms of two- and three-base sequence cases.
@@ -62,12 +62,12 @@ The `chain(_:...)` function takes two or more sequences as arguments.
62
62
63
63
The resulting `AsyncChainSequence` type is an asynchronous sequence, with conditional conformance to `Sendable` when the arguments conform.
64
64
65
-
When any of the asynchronous sequences being chained together come to their end of iteration the `AsyncChainSequence` iteration proceeds on to the next asynchronous sequence. When the last asynchronous sequence reaches the end of iteration the `AsyncChainSequence` then ends its iteration. At any point in time if one of the comprising asynchronous sequences ever throw an error during iteration the resulting `AsyncChainSequence` iteration will throw that error and end iteration.
65
+
When any of the asynchronous sequences being chained together come to their end of iteration, the `AsyncChainSequence` iteration proceeds to the next asynchronous sequence. When the last asynchronous sequence reaches the end of iteration, the `AsyncChainSequence` then ends its iteration.
66
66
67
-
The throwing behavior of `AsyncChainSequence` is that it will throw when any of its comprising bases throw, and will not throw when all of its comprising bases do not throw.
67
+
At any point in time, if one of the comprising asynchronous sequences throws an error during iteration, the resulting `AsyncChainSequence` iteration will throw that error and end iteration. The throwing behavior of `AsyncChainSequence` is that it will throw when any of its comprising bases throw, and will not throw when all of its comprising bases do not throw.
68
68
69
69
### Naming
70
70
71
71
This function's and type's name match the term of art used in other languages and libraries.
72
72
73
-
This combinator function is a direct analog to the synchronous version [defined in the Swift Algorithms package](https://github.com/apple/swift-algorithms/blob/main/Guides/Chain.md).
73
+
This combinator function is a direct analog to the synchronous version [defined in the Swift Algorithms package](https://github.com/apple/swift-algorithms/blob/main/Guides/Chain.md).
Copy file name to clipboardExpand all lines: Guides/CombineLatest.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Given some sample inputs the following combined events can be expected.
25
25
26
26
## Detailed Design
27
27
28
-
This function family and the associated family of return types are prime candidates for variadic generics. Until that proposal is accepted these will be implemented in terms of two and threebase sequence cases.
28
+
This function family and the associated family of return types are prime candidates for variadic generics. Until that proposal is accepted, these will be implemented in terms of two- and three-base sequence cases.
@@ -62,13 +62,13 @@ public struct AsyncCombineLatest3Sequence<Base1: AsyncSequence, Base2: AsyncSequ
62
62
63
63
```
64
64
65
-
The `combineLatest(_:...)` function takes two or more asynchronous sequences as arguments with the resulting`AsyncCombineLatestSequence` which is an asynchronous sequence.
65
+
The `combineLatest(_:...)` function takes two or more asynchronous sequences as arguments and produces an `AsyncCombineLatestSequence` which is an asynchronous sequence.
66
66
67
-
Since the bases comprising the `AsyncCombineLatestSequence` must be iterated concurrently to produce the latest value it means that those sequences must be able to be sent to child tasks. This means that a prerequisite of the bases must be that the base asynchronous sequences, their iterators, and the elemnts they produce must be `Sendable`.
67
+
Since the bases comprising the `AsyncCombineLatestSequence` must be iterated concurrently to produce the latest value, those sequences must be able to be sent to child tasks. This means that a prerequisite of the bases must be that the base asynchronous sequences, their iterators, and the elemnts they produce must all be `Sendable`.
68
68
69
-
If any of the bases terminate before the first element is produced then the `AsyncCombineLatestSequence` iteration can never be satisfied so if a base's iterator returns nil at the first iteration then the `AsyncCombineLatestSequence` iterator immediately returns nil to signify a terminal state. In this particular case any outstanding iteration of other bases will be cancelled. After the first element is produced this behavior is different since the latest values can still be satisfied by at least one base. This means that beyond the construction of the first tuple comprised of the returned elements of the base the terminal state of the `AsyncCombineLatestSequence` iteration will only be reached when all of the base iterations reach a terminal state.
69
+
If any of the bases terminate before the first element is produced, then the `AsyncCombineLatestSequence` iteration can never be satisfied. So, if a base's iterator returns `nil` at the first iteration, then the `AsyncCombineLatestSequence` iterator immediately returns `nil` to signify a terminal state. In this particular case, any outstanding iteration of other bases will be cancelled. After the first element is produced ,this behavior is different since the latest values can still be satisfied by at least one base. This means that beyond the construction of the first tuple comprised of the returned elements of the bases, the terminal state of the `AsyncCombineLatestSequence` iteration will only be reached when all of the base iterations reach a terminal state.
70
70
71
-
The throwing behavior of `AsyncCombineLatestSequence` is that if any of the bases throw then the composed asynchronous sequence then throws on its iteration. If at any point (within the first or afterwards) an error is thrown by any base, the other iterations are cancelled and the thrown error is immediately thrown to the consuming iteration.
71
+
The throwing behavior of `AsyncCombineLatestSequence` is that if any of the bases throw, then the composed asynchronous sequence throws on its iteration. If at any point (within the first iteration or afterwards), an error is thrown by any base, the other iterations are cancelled and the thrown error is immediately thrown to the consuming iteration.
Copy file name to clipboardExpand all lines: Guides/Merge.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Given some sample inputs the following merged events can be expected.
25
25
26
26
## Detailed Design
27
27
28
-
This function family and the associated family of return types are prime candidates for variadic generics. Until that proposal is accepted these will be implemented in terms of two and threebase sequence cases.
28
+
This function family and the associated family of return types are prime candidates for variadic generics. Until that proposal is accepted, these will be implemented in terms of two- and three-base sequence cases.
@@ -64,17 +64,17 @@ public struct AsyncMerge3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Ba
64
64
65
65
```
66
66
67
-
The `merge(_:...)` function takes two or more asynchronous sequences as arguments with the resulting`AsyncMergeSequence` which is an asynchronous sequence.
67
+
The `merge(_:...)` function takes two or more asynchronous sequences as arguments and produces an`AsyncMergeSequence` which is an asynchronous sequence.
68
68
69
-
Since the bases comprising the `AsyncMergeSequence` must be iterated concurrently to produce the latest value it means that those sequences must be able to be sent to child tasks. This means that a prerequisite of the bases must be that the base asynchronous sequences, their iterators, and the elements they produce must be `Sendable`.
69
+
Since the bases comprising the `AsyncMergeSequence` must be iterated concurrently to produce the latest value, those sequences must be able to be sent to child tasks. This means that a prerequisite of the bases must be that the base asynchronous sequences, their iterators, and the elements they produce must be `Sendable`.
70
70
71
-
When iterating a `AsyncMergeSequence` it becomes terminal when all of the base asynchronous sequences are terminal; meaning there is no more potential of any elements being produced.
71
+
When iterating a `AsyncMergeSequence`, the sequence terminates when all of the base asynchronous sequences terminate, since this means there is no potential for any further elements to be produced.
72
72
73
-
The throwing behavior of `AsyncMergeSequence` is that if any of the bases throw then the composed asynchronous sequence then throws on its iteration. If at any point an error is thrown by any base, the other iterations are cancelled and the thrown error is immediately thrown to the consuming iteration.
73
+
The throwing behavior of `AsyncMergeSequence` is that if any of the bases throw, then the composed asynchronous sequence throws on its iteration. If at any point an error is thrown by any base, the other iterations are cancelled and the thrown error is immediately thrown to the consuming iteration.
74
74
75
75
### Naming
76
76
77
-
Since the inherent behavior of `merge(_:...)` merges values from multiple streams into a singular asynchronous sequence the naming is intended to be quite literal. There are precedent terms of art in other frameworks and libraries (listed in the comparison section). Other naming takes the form of "withLatestFrom". This was disregarded since the "with" prefix is often most associated with the passing of a closure and some sort of contextual concept; `withUnsafePointer` or `withUnsafeContinuation` are prime examples.
77
+
Since the inherent behavior of `merge(_:...)` merges values from multiple streams into a singular asynchronous sequence, the naming is intended to be quite literal. There are precedent terms of art in other frameworks and libraries (listed in the comparison section). Other naming takes the form of "withLatestFrom". This was disregarded since the "with" prefix is often most associated with the passing of a closure and some sort of contextual concept; `withUnsafePointer` or `withUnsafeContinuation` are prime examples.
0 commit comments