<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I’ve pondered proposing adding break and continue as results from a closure the same way return and ErrorType are today, and a modifier flag on function declarations similar to “throws” to indicate support.&nbsp;<div class=""><br class=""></div><div class="">The main complexity seemed to be in supporting labels (as well as when to not support them - labels would only make sense when the closure was declared inline.) Another thought was that it did not make sense for closure-level return, break, and continue to all be available at once&nbsp;<div class=""><br class=""></div><div class="">-DW</div><div class="">&nbsp;&nbsp;<br class=""><div><blockquote type="cite" class=""><div class="">On Jan 9, 2016, at 1:21 PM, Greg Parker via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 8, 2016, at 10:00 PM, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I sympathize with the problem statement, but I wonder if we should instead be considering ways of allowing control-flow statements (break, continue, return) to work from inside @noescape closures.</div></div></blockquote><br class=""></div><div class="">@noescape is insufficient to allow that. You need more constraints on the closure's caller, perhaps even cooperation from the closure's caller depending on how the control flow is supposed to work.</div><div class=""><br class=""></div><div class="">Off the top of my head:</div><div class="">* The closure's caller can't call the closure more than once. Or if it does, it needs to participate in the control flow system somehow. (Example: what does `break` do in the middle of map().)</div><div class="">* Return values are complicated. You might need to limit the system to void returning closures only.</div><div class="">* Defining the closure in one place and handing it off in another is complicated. You might need to limit the system to closure literals only.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">--&nbsp;</div><div class="">Greg Parker &nbsp; &nbsp; <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a>&nbsp; &nbsp; &nbsp;Runtime Wrangler</div><div class=""><br class=""></div><div class=""><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=nE9rxSXA5G4kxsTVkgv43vFcOQoCM-2FU-2BigXPSqPoICINfgUOJoLLOMYNjNIBcA2-2Fnh44x7Xjl8eDTsP1z4pqRCMsMABfZIt6t6NoJ8rQ7ubZPNRbMGtHB0Fagd8LuEHRhj9vbzRUkSupbPOXKB8xcfk-2F2fItHet2wG4rGi8xTN-2BHJCPBJ0fqPg2dobu1YJQonjv9NGxkefpZq-2BvrBMRaYQ4b7Vhokr-2FZQg5ra26UPw8-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>