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

Dave Abrahams dabrahams at apple.com
Sun Jun 26 09:05:41 CDT 2016


on Wed Jun 22 2016, Matthew Johnson <swift-evolution at swift.org> wrote:

>> E.g., the current Iterator could gain a
>> class constraint and become the only representation of single-pass
>> sequences.
>
> Hmm.  I would have to give this more thought.  Do we really want to
> require all conformances of `Iterator` to be reference types?  What
> would be the performance impact of that?

It's not necessarily a problem.  In almost any context where Iterators
are used they could be promoted by the optimizer from the heap to the
stack.

-- 
-Dave



More information about the swift-evolution mailing list