<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=""><div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><div class=""></div><blockquote type="cite" class=""><div class=""><font color="#5856d6" class="">func foo() {</font></div><div class=""><font color="#5856d6" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let bar: Int</font></div><div class=""><font color="#5856d6" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>withNoEscape { bar = 1 }</font></div><div class=""><font color="#5856d6" class="">}</font></div><div class=""><font color="#5856d6" class=""><br class=""></font></div><div class=""><font color="#5856d6" class="">func withNoEscape(@autoclosure(once) closure: () -> ()) { /* snip */ }</font></div></blockquote></div><div class=""><br class=""></div>Looking back, I do think that there should be a way to exit from `withNoEscape` without calling the closure, so yes, throwing should imply that the closure wasn't executed. If it's possible that `foo` swallowed an error from a throwing `withNoEscape`, the compiler should assume that the variables within haven't been initialized:</div></div></blockquote><br class=""></div><div>I’m glad to see an @autoclosure func in this thread. We will want to be able to use this feature with @autoclosure in addition to @noescape.</div><div><br class=""></div><div>As far as exiting without calling the closure, I suggest `@noescape(once?)`. The `?` indicates the closure may or may not be called, but <b class="">will not</b> be called more than once.</div><div><br class=""></div><div>This would be handy in the case of the short-circuiting boolean operators, for example:</div><div><br class=""></div><div>@warn_unused_result func &&<T : BooleanType, U : BooleanType>(_ lhs: T, @autoclosure(once?) _ rhs: () throws -> U) rethrows -> Bool</div><div><br class=""></div><div>-Matthew</div></body></html>