[swift-evolution] [Pitch] Move @noescape

Howard Lovatt howard.lovatt at gmail.com
Sat Mar 5 14:43:25 CST 2016

Another point. I prefer lines to be ordered from most important bit of
information to least. That is why I prefer trailing ':' type information to
C-style declarations. Therefore my preference would be:

    func f(a: () -> () @autoclosure) {}

Since the name is the most important, the type the next most, and lastly
the annotation is the least important bit of information.

On Saturday, 5 March 2016, Chris Lattner via swift-evolution <
swift-evolution at swift.org> wrote:

> On Mar 4, 2016, at 9:32 PM, Brent Royal-Gordon <brent at architechies.com
> <javascript:;>> wrote:
> >> 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:
> >>
> >>      func f(a : @autoclosure () -> ()) {}
> >>
> >> for consistency.  Yes, I totally get the irony of the fact that
> @autoclosure used to be on the type in swift 1.
> >
> > 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?
> I don’t think that it is wildly “widely useful”, but yes, it certainly
> makes sense.  Not having it makes the language less orthogonal.
> > 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?
> That is orthogonal to my proposal, but yes, these are different function
> types since they have different behaviors at the use site.
> > 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),
> 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.
> -Chris
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <javascript:;>
> https://lists.swift.org/mailman/listinfo/swift-evolution

-- Howard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160306/d9c9a21c/attachment.html>

More information about the swift-evolution mailing list