> On Jun 27, 2016, at 9:39 AM, Dave Abrahams via swift-evolution 
> <swift-evolution@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.


Russ
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to