[swift-evolution] [Draft] Change IteratorType post-nil guarantee
Patrick Pijnappel
patrickpijnappel at gmail.com
Fri Mar 18 23:51:19 CDT 2016
I wasn't counting Zip as that tracks it for different reasons (as you point
out). The remaining two are in UTF-8/UTF-16 decoding (the done flag is
inside the lookahead flags):
https://github.com/apple/swift/blob/master/stdlib/public/core/Unicode.swift#L296
https://github.com/apple/swift/blob/master/stdlib/public/core/Unicode.swift#L485
On Sat, Mar 19, 2016 at 2:16 PM, Brent Royal-Gordon <brent at architechies.com>
wrote:
> > Current – post-nil unspecified
> > – Responsibility of the caller, needs to be aware of the API contract
> and needs to track a bool and branch when relying on post-nil.
> > – Standard library currently has 3 occurrences of this being necessary.
>
> I got curious and decided to try to locate these. I found two:
>
>
> https://github.com/apple/swift/blob/a147a582fec7f0bcf058d089d79fb0950c261db9/stdlib/public/core/Sequence.swift#L435
>
> https://github.com/apple/swift/blob/97d8f50af4978e54289377a0bd205e71a34529a2/stdlib/public/core/Zip.swift#L52
>
> (Interestingly the Zip one is defensive programming: ZipGenerator.next()
> is ensuring it doesn't incorrectly call its child generators' next()
> methods even if is itself called too many times.)
>
> What was the third? I must have missed it.
>
> --
> Brent Royal-Gordon
> Architechies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160319/4557cd3d/attachment.html>
More information about the swift-evolution
mailing list