# Swift Async Algorithms: Design Guidelines

**URL:** <https://forums.swift.org/t/swift-async-algorithms-design-guidelines/61629>\
**Category:** Swift Async Algorithms\
**Tags:** swift-evolution, asyncawait, asyncsequence\
**Created:** [November 26, 2022, 12:06pm UTC](https://forums.swift.org/t/swift-async-algorithms-design-guidelines/61629 "2022-11-26T12:06:47Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Karl](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@Karl](https://forums.swift.org/u/Karl)\
**Post date:** [November 26, 2022, 6:30pm UTC](https://forums.swift.org/t/swift-async-algorithms-design-guidelines/61629/13 "2022-11-26T18:30:31Z")

</div>

> [@tcldr](#):
>
> What I'm saying is that an asynchronous sequence that is iterated multiple times probably wouldn't `fatalError()` in an ideal world.

Yeah I disagree. You should _hope_ that it traps. It is definitely the ideal outcome.

Take this example, from the Sequence documentation:

```swift
for element in sequence {
    if ... some condition { break }
}

for element in sequence {
    // No defined behavior
}

```

That should scare the living daylights out of anybody who writes generic algorithms using Sequence.

Too many developers have this idea that trapping is the worst thing that can happen. Unpredictable behaviour should never be the preferable outcome.

---

_[View the full topic](https://forums.swift.org/t/swift-async-algorithms-design-guidelines/61629)._
