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

Russ Bishop xenadu at gmail.com
Thu Jun 30 12:51:58 CDT 2016

> On Jun 30, 2016, at 10:26 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>  It would
> be very interesting to know about any real-world models of single-pass
> sequences that people are using in Swift, since we don't supply any in
> the standard library.
> -- 
> Dave

I already gave an example of this earlier in the thread:

>> I use it in a LazyRowSequence<T: SqlModelConvertible> where querying Sqlite in WAL mode allows multiple concurrent readers to get point-in-time snapshots of the database. The query can’t be replayed without buffering all the rows in memory because Sqlite’s step functions are not bi-directional. In some cases we are talking about tens of thousands of rows (or even hundreds of thousands) and the ability to avoid buffering them is a feature, not a bug.

IMHO the typical case for single-pass is IO. In this case it would work just as well as LazyRowIterator<T> assuming the language allows for-in on an iterator.

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

More information about the swift-evolution mailing list