<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 class="">This is problematic when there are multiple levels of closure:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">fn: (Int) -&gt; (Int) -&gt; (Int, Int) @convention(block)</div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">// without the attribute, equivalent to</blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">fn: (Int) -&gt; ((Int) -&gt; (Int, Int))</blockquote><div class=""><br class=""></div><div class="">Of course neither @noescape nor @autoclosure can apply to an arbitrary function value, but @convention can.</div><div class=""><br class=""></div><div class="">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><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 5, 2016, at 12:43, Howard Lovatt 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="">Another point. I prefer lines to be ordered from most&nbsp;important bit of information to least. That is why I prefer trailing ':'&nbsp;<span class=""></span>type information to C-style declarations.&nbsp;Therefore my preference would be:<div class=""><br class=""></div><div class="">&nbsp; &nbsp; func f(a: () -&gt; ()&nbsp;@autoclosure) {}</div><div class=""><br class=""></div><div class="">Since the name is the most important, the type the next most, and lastly the&nbsp;annotation is the least important bit of information.&nbsp;<br class=""><br class="">On Saturday, 5 March 2016, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><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 &lt;<a href="javascript:;" onclick="_e(event, 'cvml', 'brent@architechies.com')" class="">brent@architechies.com</a>&gt; wrote:<br class="">
&gt;&gt; This seems dumb to me :-) you should be able to write the type for any declaration you can produce.&nbsp; Once you do that, it makes sense to spell the original function as:<br class="">
&gt;&gt;<br class="">
&gt;&gt;&nbsp; &nbsp; &nbsp; func f(a : @autoclosure () -&gt; ()) {}<br class="">
&gt;&gt;<br class="">
&gt;&gt; for consistency.&nbsp; Yes, I totally get the irony of the fact that @autoclosure used to be on the type in swift 1.<br class="">
&gt;<br class="">
&gt; 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 `&amp;&amp;` or `Result(try something())`. Does that feature make sense for closures?<br class="">
<br class="">
I don’t think that it is wildly “widely useful”, but yes, it certainly makes sense.&nbsp; Not having it makes the language less orthogonal.<br class="">
<br class="">
&gt; Even if it does, does it make sense for there to be a type error when you pass a `Foo -&gt; Bar` where an `@autoclosure Foo -&gt; Bar` is expected, or vice versa?<br class="">
<br class="">
That is orthogonal to my proposal, but yes, these are different function types since they have different behaviors at the use site.<br class="">
<br class="">
&gt; 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 class="">
<br class="">
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 class="">
<br class="">
-Chris<br class="">
<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div><br class=""><br class="">-- <br class="">-- Howard.<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="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>