# Should Dictionary support first related methods from Collection conformance?

**URL:** <https://forums.swift.org/t/should-dictionary-support-first-related-methods-from-collection-conformance/32208>\
**Category:** Discussion\
**Created:** [January 3, 2020, 6:54pm UTC](https://forums.swift.org/t/should-dictionary-support-first-related-methods-from-collection-conformance/32208 "2020-01-03T18:54:57Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![dabrahams](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dabrahams/32/9815_2.png) [@dabrahams](https://forums.swift.org/u/dabrahams)\
**Post date:** [January 4, 2020, 10:49pm UTC](https://forums.swift.org/t/should-dictionary-support-first-related-methods-from-collection-conformance/32208/20 "2020-01-04T22:49:24Z")

</div>

> [@Karl](#):
>
> This discussion is drifting slightly off-topic, but personally I don't subscribe to the idea of `Sequence` being single-pass, whatever its documentation says; IteratorProtocol is the one, true, single-pass type! It mutates when producing elements and once exhausted, will never return anything again. Sequence is able to produce iterators without mutating, so it seems obviously to be the multi-pass type.

One would think that, wouldn't one?! It turns out, though, that if you want one protocol to support `for`…`in` loops, _and_ you want to be able to uniformly loop over both an immutable `Array` and a single-pass stream that is consumed by iteration, you end up needing `Sequence`: a thing you can get an iterator from without mutating it (try working out the design—you'll see!)…

…_unless_, that is, you have first-class language support for move-only types, by which I mean:

- There's a category of operations, known to the type system, that _consume_ values of move-only type (ending their lifetime), but automatically receive a _copy_ of any copyable value.
- Single-pass algorithms (and `for`…`in`) belong to that category.
- Single-pass sequences are move-only types.

---

_[View the full topic](https://forums.swift.org/t/should-dictionary-support-first-related-methods-from-collection-conformance/32208)._
