<div dir="ltr">My enthusiasm got the better of me... of course I meant (@noescape () -> Void) -> Void.<div class="gmail_extra">
<br><div class="gmail_quote">On Thu, Mar 3, 2016 at 2:14 PM, Jacob Bandes-Storch <span dir="ltr"><<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Will this allow me to write "let myDispatchSync = dispatch_sync as! @noescape () -> Void" ? :-D<br><div><br></div><div>Sounds good to me, the old syntax is not necessary anymore.</div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div><div dir="ltr"><div>Jacob<br></div></div></div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On Thu, Mar 3, 2016 at 2:01 PM, Chris Lattner via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><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>
<br>
func curriedFlatMap<A, B>(x: [A]) -> (@noescape A -> [B]) -> [B] {<br>
return { f in<br>
x.flatMap(f)<br>
}<br>
}<br>
<br>
Was rejected. Fixing this was straight-forward (<a href="https://github.com/apple/swift/commit/c3c6beac72bc0368030f06d52c46b6444fc48dbd" rel="noreferrer" target="_blank">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>
<br>
func f(@noescape fn : () -> ()) {}<br>
func f(fn : @noescape () -> ()) {}<br>
<br>
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>
<br>
Thoughts?<br>
<br>
-Chris<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>