[swift-evolution] Closure Syntax

Chris Lattner clattner at apple.com
Fri Jan 1 17:05:16 CST 2016


> On Jan 1, 2016, at 2:21 PM, Ethan Diamond <edgewood7558 at gmail.com> wrote:
> 
> FWIW I don't think the backlash to the use of ^ with Obj-C blocks was because of the carat itself,

Fair enough, different people have different objections.  I’m sure some people love blocks syntax :-)

> but because of the inconsistency of the syntax in different contexts. Sometimes the return type was after the ^, sometimes before. Sometimes you had to use (^). Sometimes the carat had the name of the block with it ^functionName. None of it fit in with the [object methodName] syntax of the language itself. 

No, it fit perfectly with C.  Blocks are an extension to C, not technically an Objective-C extension.

> Anyway, if closure syntax is unofficially set in stone then that's that. I still appreciate you taking the time to listen.

I understand the other points you make, but again, we’re pretty happy with closure syntax as is.  Keeping the arguments inside the closure has a ton of advantages for the expression grammar (making it possible to parse :-) and allows trailing closures to emulate builtin statements.

-Chris



More information about the swift-evolution mailing list