[swift-evolution] Lambda function syntax
Alexander Regueiro
alexreg at gmail.com
Wed Dec 23 11:08:56 CST 2015
I agree on this. For large closures, `$0` isn’t very clear what you’re referring to. Personally, I’d rather remove them altogether, but I don’t want to start a subdiscussion on that here.
> On 23 Dec 2015, at 09:42, Tino Heth <2th at gmx.de> wrote:
>
>
>> love trailing closures
> I wouldn't go that far and just say "})" looks ugly — but that has the same implications ;-)
> With parameters, trailing closures loose a lot of their appeal, and an alternative syntax ("func(x: Int) {" instead of "{ x: Int in}" isn't that bad for trailing closure either.
>
> The only obvious downside is the "$0" shortcut would be confusing with "func() {" (but not so much with "func {"…).
> Speaking of "$0", you could argue why it is allowed in closures and not in methods… but I'm in some discord with $0 anyways:
> It is really nice for small constructs, but drawing the line when to discourage their use is tough (at least to tough for the compiler to enforce a rule).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151223/0c96bf79/attachment.html>
More information about the swift-evolution
mailing list