[Pitch] Make Collection Super-Convenient and Retire Sequence

I think conceptualizing a one-pass sequence as a Stream better represents things like a random number generator or user input. The output can be created but it can't be repeated and it may be infinite.

As you started out discussing, Sequence is most commonly a walk along knowable data, so is multipass. A walk produces iterable values. A knowable data source can have multiple walks, like striding, which is what @soroush and I were discussing in https://forums.swift.org/t/pitch-adding-strideable-sequences. We quickly converged on behavior that unified sequences and collections.

As for streams, I started putting together a very rough concept of Stream last week because I wanted to think through the problem space: stream.swift · GitHub I slightly disagree with @davedelong in its utility (He writes, "They’re rare enough in practice that I don’t think we need a way to generalize their existence"). I think representing any real world input, whether audio from a microphone, feeds from a website, tweets from social media, or as mentioned above random numbers and user input, all can be well represented as streams.

7 Likes