[swift-users] [swift-evolution] for-else syntax

Rob Mayoff mayoff at dqd.com
Sat Feb 4 21:31:43 CST 2017


On Fri, Feb 3, 2017 at 7:15 PM, Howard Lovatt via swift-users <
swift-users at swift.org> wrote:

> Why not add to the library:
>
> extension Sequence {
>     func forEach(_ eacher: (Iterator.Element) throws -> Void, elser: ()
> throws -> Void) rethrows {
>

This doesn't work with break or continue and changes the meaning of return.

It would be nice for Swift to support Tcl-like exceptional return codes so
we can build control flow functions that work with break, continue, and
return properly.

http://www.tcl.tk/man/tcl/TclCmd/return.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170204/68f8808c/attachment.html>


More information about the swift-users mailing list