[Review] SE-0094: Add sequence(initial:next:) and sequence(state:next:) to the stdlib

I think Kevin will agree that I was really slow on uptake in terms of the state version, but once
I *got* it, I found that I kept using it. Yesterday, I was showing someone some math using cubic
Beziers, and boom there was the extra "var t = 0.0" sitting out there, which I immediately recognized
and refactored into the sequence(state:next:) version instead. It produced a much cleaner and
more pleasing result, imo. (I also found a dandy playground bug unrelated.)

I know that the idea of an extra capture mentally feels ugly but it's really useful. A week ago,
I wouldn't have fought to keep the option. Now, I would.

-- E

···

On May 25, 2016, at 2:18 PM, Kevin Ballard via swift-evolution <swift-evolution@swift.org> wrote:

We think the need to do a capture is icky, so the sequence form is
almost always better.

I agree that the need for a capture is ugly.

The design of AnySequence and AnyIterator dates from a time when the
compiler was very immature and many design avenues we might have taken
were not available. I find the `sequence` forms to be superior in
general, and IMO at some point we should re-evaluate the interfaces to
AnySequence and AnyIterator.

That sounds like a reasonable justification for keeping sequence(state:next:).

-Kevin Ballard

These two paragraphs sound like they're almost saying opposite things.
It's only AnyIterator/AnySequence that makes you create captures. Care
to clarify?

···

on Wed May 25 2016, Erica Sadun <erica-AT-ericasadun.com> wrote:

On May 25, 2016, at 2:18 PM, Kevin Ballard via swift-evolution <swift-evolution@swift.org> wrote:

We think the need to do a capture is icky, so the sequence form is
almost always better.

I agree that the need for a capture is ugly.

The design of AnySequence and AnyIterator dates from a time when the
compiler was very immature and many design avenues we might have taken
were not available. I find the `sequence` forms to be superior in
general, and IMO at some point we should re-evaluate the interfaces to
AnySequence and AnyIterator.

That sounds like a reasonable justification for keeping sequence(state:next:).

-Kevin Ballard

I think Kevin will agree that I was really slow on uptake in terms of
the state version, but once I *got* it, I found that I kept using
it. Yesterday, I was showing someone some math using cubic Beziers,
and boom there was the extra "var t = 0.0" sitting out there, which I
immediately recognized and refactored into the sequence(state:next:)
version instead. It produced a much cleaner and more pleasing result,
imo. (I also found a dandy playground bug unrelated.)

I know that the idea of an extra capture mentally feels ugly but it's
really useful. A week ago, I wouldn't have fought to keep the
option. Now, I would.

--
-Dave