# SE-0314: AsyncStream and AsyncThrowingStream

**URL:** <https://forums.swift.org/t/se-0314-asyncstream-and-asyncthrowingstream/48198>\
**Category:** Proposal Reviews\
**Created:** [May 11, 2021, 7:50pm UTC](https://forums.swift.org/t/se-0314-asyncstream-and-asyncthrowingstream/48198 "2021-05-11T19:50:32Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![benrimmington](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/benrimmington/32/695_2.png) [@benrimmington](https://forums.swift.org/u/benrimmington)\
**Post date:** [May 12, 2021, 12:15am UTC](https://forums.swift.org/t/se-0314-asyncstream-and-asyncthrowingstream/48198/5 "2021-05-12T00:15:46Z")

</div>

The naming difficulties were mentioned during the [pitch](https://forums.swift.org/t/pitch-asyncstream-and-asyncthrowingstream/47820/18) phase.  
Would "[generator](https://en.wikipedia.org/wiki/Generator_(computer_programming))" be a valid alternative to "stream"?

Similar to [SE-0300](https://github.com/apple/swift-evolution/blob/main/proposals/0300-continuation.md), could the throwing and non-throwing types be combined?

Instead of the nested `Termination` enum, could an optional failure type be used?  
However, `.cancelled` would require `Failure == Error` or `Failure == CancellationError`.

```swift
public struct AsyncGenerator<Element, Failure: Error> {
  public struct Continuation: Sendable {
    public func yield(_ value: Element)
    public func finish(throwing error: Failure? = nil)
    public var onTermination: (@Sendable (Failure?) -> Void)? { get nonmutating set }
  }
}

```

---

_[View the full topic](https://forums.swift.org/t/se-0314-asyncstream-and-asyncthrowingstream/48198)._
