[swift-evolution] Proposal: Add SequenceType.first

Kevin Ballard kevin at sb.org
Thu Dec 31 18:19:16 CST 2015


I've submitted a proposal to the ML for BufferedSequence / BufferedGenerator as https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151228/005010.html. I kept the name "peek" for the method because, as mentioned in that email, there's plenty of precedent for it.

-Kevin Ballard

P.S. The plain-text version of the email is hard to read because the
     FastMail web interface doesn't handle rich text very well. The rich
     text version should be much more readable.

On Thu, Dec 31, 2015, at 02:03 PM, Dave Abrahams wrote:
>>> I suggest you consider adding a BufferedSequence<Base: SequenceType>
>>> that has a stable first property (at least until it is iterated)
>>
>> Good idea, though I'd probably call it PeekSequence because it would
>> only buffer a single element (and BufferedSequence sounds like it's
>> got an arbitrary-sized buffer). Perhaps more useful would be the
>> associated PeekGenerator, because peek() is a useful thing to have
>> when writing custom generator-using code.
>
> The size of the buffer is an implementation detail, and I don’t find
> “peek” descriptive.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151231/2bc5a3df/attachment.html>


More information about the swift-evolution mailing list