[swift-evolution] [Proposal]: support disable to trailing closure syntax

Kevin Ballard kevin at sb.org
Tue Jan 5 12:59:31 CST 2016


On Tue, Jan 5, 2016, at 10:47 AM, Chris Lattner via swift-evolution wrote:
> 
> > On Jan 5, 2016, at 8:07 AM, Dennis Lysenko via swift-evolution <swift-evolution at swift.org> wrote:
> > 
> > Everyone, 
> > 
> > The sticking point here is that xcode generates the first syntax automatically. 
> > 
> > Simply filing a radar about this would be useless, so I believe the original proposal is meant to sort-of "light a fire" under the Xcode team; by introducing a new language feature they would be forced to support it. 
> > 
> > Personally, I think it should just be fixed in Xcode as well, but it's not that simple. 
> 
> FWIW, the algorithms used by Swift’s code completion in Xcode are part of sourcekit, which is included in Swift.org.

Oh really? So I could actually go in there and fix it to stop generating closures that look like

    foo { () -> Void in
        <#code#>
    }

(the `() -> Void in` is rather pointless)

In that case, I suppose it makes sense to actually discuss proposed code completion changes on this list. On the subject of disabling trailing closure syntax, it might make sense to have Xcode not use it automatically when the function has 2 closure parameters (sometimes I do want the second closure to be trailing-closure, sometimes I don't, but it seems reasonable to err on the side of not having it be trailing-closure if there's more than 1 closure in the call).

-Kevin Ballard


More information about the swift-evolution mailing list