[swift-evolution] [Pitch] Remove destructive consumption from Sequence

Russ Bishop xenadu at gmail.com
Mon Jun 27 18:20:33 CDT 2016

> On Jun 27, 2016, at 9:39 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> Perhaps the language should accept types conforming to either of two
> unrelated protocols (your Sequence and Iterator, as you've described
> them, with no refinement relationship) for for-in.

The more I think about it the more I think this is a good model. Iterator is already single-use. Sequence then describes a type that can vend multiple iterators and is inherently multi-pass. I would argue the protocol is making this guarantee already, since makeIterator() naturally lends itself to multiple invocations.

In my example, LazyRowSequence becomes LazyRowIterator.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160627/13947e10/attachment.html>

More information about the swift-evolution mailing list