<div dir="ltr">You could use brackets, e.g.:<div><br></div><div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">fn: (Int) -> (Int) -> (Int, Int) @convention(block)</blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">// Is the same as:</blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">fn: (Int) -> ((Int) -> (Int, Int)) <span style="font-size:12.8px">@convention(block)<br>// Which is not the same as:<br></span><span style="font-size:12.8px">fn: (Int) -> ((Int) -> (Int, Int) </span><span style="font-size:12.8px">@convention(block))</span><span style="font-size:12.8px"><br></span></blockquote></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"> -- Howard.<br></div></div>
<br><div class="gmail_quote">On 9 March 2016 at 10:16, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>This is problematic when there are multiple levels of closure:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>fn: (Int) -> (Int) -> (Int, Int) @convention(block)</div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px">// without the attribute, equivalent to</blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px">fn: (Int) -> ((Int) -> (Int, Int))</blockquote><div><br></div><div>Of course neither @noescape nor @autoclosure can apply to an arbitrary function value, but @convention can.</div><div><br></div><div>It's also inconsistent with all other attributes in the language. I see the idea of most-to-least important, but I don't think it actually results in a more readable syntax here.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Jordan</div></font></span><div><div class="h5"><div><br></div><br><div><blockquote type="cite"><div>On Mar 5, 2016, at 12:43, Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div>Another point. I prefer lines to be ordered from most important bit of information to least. That is why I prefer trailing ':' <span></span>type information to C-style declarations. Therefore my preference would be:<div><br></div><div> func f(a: () -> () @autoclosure) {}</div><div><br></div><div>Since the name is the most important, the type the next most, and lastly the annotation is the least important bit of information. <br><br>On Saturday, 5 March 2016, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mar 4, 2016, at 9:32 PM, Brent Royal-Gordon <<a>brent@architechies.com</a>> wrote:<br>
>> This seems dumb to me :-) you should be able to write the type for any declaration you can produce. Once you do that, it makes sense to spell the original function as:<br>
>><br>
>> func f(a : @autoclosure () -> ()) {}<br>
>><br>
>> for consistency. Yes, I totally get the irony of the fact that @autoclosure used to be on the type in swift 1.<br>
><br>
> How much sense does it really make to have a closure with an @autoclosure parameter, though? @autoclosure is meant to be syntactic sugar for when a function needs to control the evaluation of its parameters, like `&&` or `Result(try something())`. Does that feature make sense for closures?<br>
<br>
I don’t think that it is wildly “widely useful”, but yes, it certainly makes sense. Not having it makes the language less orthogonal.<br>
<br>
> Even if it does, does it make sense for there to be a type error when you pass a `Foo -> Bar` where an `@autoclosure Foo -> Bar` is expected, or vice versa?<br>
<br>
That is orthogonal to my proposal, but yes, these are different function types since they have different behaviors at the use site.<br>
<br>
> Even if we decide we have to support @autoclosure on closures, if we turn parameter labels into a feature of the variable's name instead of its type (which I believe I've seen discussed),<br>
<br>
I don’t expect that to happen (because, e.g. that would fundamentally change how currying methods works), but if it does, we can certainly re-evaluate this.<br>
<br>
-Chris<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a>swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div><br><br>-- <br>-- Howard.<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" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></div></div></blockquote></div><br></div>