[swift-evolution] Remove forEach?
Guillaume Lessard
glessard at tffenterprises.com
Wed Dec 9 12:21:18 CST 2015
> On 9 déc. 2015, at 10:43, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
>
> How would break and continue interact with the caller of the closure? It would need to implement the correct behavior of skipping to the next loop cycle or moving on to any post-loop logic.
Using logic similar to GeneratorType.next(), a `breaks` closure could effectively return an Optional<Void>.
Reaching the end or a `continue`-equivalent statement would return .Some(Void).
Exiting via the `break`-equivalent statement would return .None and signal the end of looping
Making the construct look right, however, sounds like compiler magic.
Guillaume Lessard
More information about the swift-evolution
mailing list