[swift-evolution] Lambda function syntax

Alexander Regueiro alexreg at gmail.com
Tue Dec 22 20:33:54 CST 2015


This was my first proposal, and was changed my second, but this syntax is inspired by C#, where a lambda expression is of one of the following forms:

(Type1 param1, …) => foo // single-statement expression
(Type1 param1, …) => { …; return foo; } // multi-statement expression

Haskell also uses syntax closer to this than to Swift, not to mention ML/F#.

> On 23 Dec 2015, at 02:30, Andrey Tarantsov <andrey at tarantsov.com> wrote:
> 
> So I believe the opinion of the core team and the community would be generally in opposition to the style you want. I understand your arguments, but somehow they are against the entire experience of me (and, presumably, others) as developers.
> 
> To continue our friendly banter, though, do you mind sharing your background? When I read this, I wasn't sure if you're serious or trolling:
> 
>> I would propose changing it from:
>> 
>> { (param_list) -> return_type in … }
>> 
>> to something cleaner like:
>> 
>> (param_list) -> return_type => { … }
> 
> I wonder if doing something like Haskel a lot makes you more used to that sort of arrow constructs?
> 
> This is written in good faith; I hope I used the right tone to indicate that.
> 
> A.
> 



More information about the swift-evolution mailing list