[swift-evolution] Lambda function syntax

Chris Lattner clattner at apple.com
Mon Dec 21 13:22:14 CST 2015


> On Dec 21, 2015, at 11:20 AM, Alexander Regueiro via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Does anyone not like the current syntax for this?
> 
> I would propose changing it from:
> 
> { (param_list) -> return_type in … }
> 
> to something cleaner like:
> 
> (param_list) -> return_type => { … }
> 
> where I’m not so bothered about the `=>` separator (could be `:`, `,`, or indeed `in`).
> 
> The braces being around the type specifier as well as function body rather bothers me. Surely it would be more consistent just to have the braces around the function body, and then the type specifier preceding this?

Hi Alexander,

We’re open in principle to replacing closure syntax with something better, but A) it needs to be actually better, and B) it needs to fit with the swift grammar.  If you’re interested in pushing forward in this area, please familiarize yourself with the structure of the grammar and propose what you’re thinking in terms of a diff to it.  Thanks,

-Chris


More information about the swift-evolution mailing list