<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 3, 2016, at 2:14 PM, Jacob Bandes-Storch <<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Will this allow me to write "let myDispatchSync = dispatch_sync as! @noescape () -> Void" ? :-D</div></div></blockquote><div><br class=""></div>Yes, but you need to spell it like this:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>let myDispatchSync = dispatch_sync as! ((dispatch_queue_t, @noescape @convention(block) () -> ()) -> Void)<br class=""><br class="">The right answer here is to add @noescape to the imported symbol of course.</div><div><br class=""></div><div>-Chris<br class=""><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Sounds good to me, the old syntax is not necessary anymore.</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class="">Jacob<br class=""></div></div></div></div>
<br class=""><div class="gmail_quote">On Thu, Mar 3, 2016 at 2:01 PM, Chris Lattner via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris Eidhof noticed an emergent result of removing our currying syntax: it broke some useful code using @noescape, because we only allowed it on parameter declarations, not on general things-of-function-type. This meant that manually curried code like this:<br class="">
<br class="">
func curriedFlatMap<A, B>(x: [A]) -> (@noescape A -> [B]) -> [B] {<br class="">
return { f in<br class="">
x.flatMap(f)<br class="">
}<br class="">
}<br class="">
<br class="">
Was rejected. Fixing this was straight-forward (<a href="https://github.com/apple/swift/commit/c3c6beac72bc0368030f06d52c46b6444fc48dbd" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift/commit/c3c6beac72bc0368030f06d52c46b6444fc48dbd</a>), but required @noescape being allowed on arbitrary function types. Now that we have that, these two declarations are equivalent:<br class="">
<br class="">
func f(@noescape fn : () -> ()) {}<br class="">
func f(fn : @noescape () -> ()) {}<br class="">
<br class="">
I propose that we remove the former syntax, migrating code to the later form. This leads to better consistency between our declarations and types, and follows the precedent of inout. @autoclosure should also probably move as well.<br class="">
<br class="">
Thoughts?<br class="">
<br class="">
-Chris<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>