[swift-evolution] Lambda function syntax

Brent Royal-Gordon brent at architechies.com
Sun Dec 27 16:24:14 CST 2015

> In this mail I’m answering several statements made in this thread by different people, not only Brent’s mail from which I just picked the following snippet:
>> let names = people.map => person { person.name }
> For me that is more difficult to read than
> 	let names = people.map { person in person.name }
> Especially when chaining is used, i.e.
> 	let names = people.filter => person { person.isFriend }.map => person { person.name }
> (or would I have to add parentheses somewhere with this proposed syntax?)
> vs.
> 	let names = people.filter { person in person.isFriend }.map { person in person.name }

I said in the email that => is too visually heavy for this role.

Here's something lighter, although I'm still not satisfied with it, and not seriously suggesting it:

	let names = people.map ~ person { person.name }

Or even:

	let names = people.map \person { person.name }

However, I'm really struggling to find anything that I actually like here. This may be one of those cases where we dislike what's there and explore a bunch of options, only to find out that the current thing actually is the least bad alternative after all.

Brent Royal-Gordon

More information about the swift-evolution mailing list