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">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 href="javascript:;" onclick="_e(event, 'cvml', 'brent@architechies.com')">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 href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')">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>