[swift-evolution] [Draft] Change IteratorType post-nil guarantee

Brent Royal-Gordon brent at architechies.com
Fri Mar 18 22:16:25 CDT 2016


> 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



More information about the swift-evolution mailing list