[swift-evolution] Lambda function syntax

Andrey Tarantsov andrey at tarantsov.com
Tue Dec 22 20:10:46 CST 2015


Can't help commenting...

> I can only see subjective “dislike this”.

The feel of the language is very important. We're talking about improving the syntax to look better here, so of course the subjective look of it matters most.

> Using “func” or “lambda” outside is uglier than “in” inside the braes? Really?

A thousand times yes. "in" is unfortunate, but adding a keyword would be... backwards doesn't quite capture it. It would destroy a big portion of the fun of the entire language.

> And closures are really *not* control flow statements, so treating like them is just a fallacy and source of confusion.

...but it looks and reads very good. ;-)


The only thing that I find wrong is "in". It just doesn't look delimited enough. foo.map { bar in bar.boz} is heavy on the eyes, while foo.map { |bar| bar.boz } would be ideal.

A man can dream, right?

Honestly, I think I understand the tradeoffs involved, so I'm fine with letting that "in" be.

A.



More information about the swift-evolution mailing list