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

Erica Sadun erica at ericasadun.com
Fri Mar 18 09:16:43 CDT 2016


What about Kevin's Rust-like approach (the fuse) as an alternative considered? 
He suggested that instead of changing the guarantees and behavior of the existing
GeneratorType, that Swift introduce a new FuseGenerator adaptor that could include 
extra state ensuring that it could safely return nil  indefinitely as Rust does

-- E


> On Mar 17, 2016, at 11:47 PM, Patrick Pijnappel via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Proposal pull request: #213 <https://github.com/apple/swift-evolution/pull/213>
> Implementation pull request: #1702 <https://github.com/apple/swift/pull/1702>
> Original pitch thread: [Proposal] Change guarantee for GeneratorType.next() to always return nil past end <http://thread.gmane.org/gmane.comp.lang.swift.evolution/8519>
> 
> Alternatives considered
> 
> Require IteratorType to not crash but keep the return value up to specific implementations. This allows them to use it for other behavior e.g. repeating the sequence after nil is returned. This however retains most of the problems of the original guaranteee described in this proposal.
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list