[swift-evolution] Lambda function syntax

Brent Royal-Gordon brent at architechies.com
Wed Dec 23 15:15:20 CST 2015

> This is very similar to my proposal. We were later suggesting the use of `=>` in place of `in`, but formerly I suggested essentially what you did here, but with `func` or `\` in place of `>=` to signify the start of a closure expression.

It seems, though, that you thought *all* closures should be marked with this character, even parameterless ones. Whereas I propose that:

>> A no-parameters closure would not require a `=>`; a bare block would still do there.

Perhaps it's a difference in perspective—I've spent nearly my entire career using languages where closures were common—but I really don't think closures need a big, obvious syntactic marker. All we need is a good way to mark the ambiguous end of the parameter list (the front end if it's outside the closure, the back end if it's inside).

Closures are not conceptually a terribly difficult feature—they're just omitted from many languages because they're difficult to *implement*. We have to be careful not to make their syntax heavier than it needs to be.

Brent Royal-Gordon

More information about the swift-evolution mailing list