[swift-evolution] Proposal: Add SequenceType.first
Brent Royal-Gordon
brent at architechies.com
Sun Jan 3 01:17:43 CST 2016
> `buffered` is no more problematic than `lazy` is. In fact, calling `buffered` actually doesn't have any side-effects at all (it can avoid fetching the first element until you call `first` on the result of `buffered`).
If `seq` is a single-pass sequence, then `seq.buffered.first` will consume an element from `seq`, even though you only accessed two properties. That's why I call it problematic.
(If calling `buffered` somehow rendered the original sequence unusable—for instance, if we had some way to express that the `BufferedSequence` takes unique ownership of its base—this wouldn't bother me as much.)
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list