Allow use of ; in anonymous closures


(Braeden Profile) #1

Okay, I currently love closure syntax, but something doesn’t sit right with me. Why can’t I write…

[6,5].map { n in; n+1 }

…where there’s a semicolon after the parameter list? I think it looks better, and should at least be allowed (not required).


(Robert Widmann) #2

`in` is syntactic fluff to disambiguate the end of a parameter list and the start of the closure's body, not a statement. In that regard it needs no additional delimiters like semicolons.

~Robert Widmann

2016/08/17 8:38、Braeden Profile via swift-evolution <swift-evolution@swift.org> のメッセージ:

···

Okay, I currently love closure syntax, but something doesn’t sit right with me. Why can’t I write…

[6,5].map { n in; n+1 }

…where there’s a semicolon after the parameter list? I think it looks better, and should at least be allowed (not required).
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution