[swift-evolution] [Proposal] Replace thin arrows (->) with fat arrows (=>)

Etan Kissling kissling at oberon.ch
Fri Dec 18 12:23:40 CST 2015

The thin arrow in Swift is used to define to result type of a function / closure.

someFuncWithClosure { (a: Int, b: Int) -> String in "\($0 + $1)" }

Am I understanding this correctly that

your first suggestion is

someFuncWithClosure { (a: Int, b: Int) -> String => "\($0 + $1)" }

and your second suggestion is

someFuncWithClosure { (a: Int, b: Int) => String in "\($0 + $1)" }


C# doesn't allow specifying the return type for closures (you have to define a delegate type first)

someFuncWithClosure((int a, int b) => string.Format("{0}", a + b));


On 18 Dec 2015, at 18:35, David Fekke via swift-evolution <swift-evolution at swift.org<mailto:swift-evolution at swift.org>> wrote:

In wanted to propose either adding the fat arrow (=>), or replacing the thin arrow with the fat arrow.

I know that Java uses the thin arrow, but  JavaScript, TypeScript and C# both allow the use of the fat arrow for lambda syntax.


David Fekke
swift-evolution mailing list
swift-evolution at swift.org<mailto:swift-evolution at swift.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/88ea7d3c/attachment.html>

More information about the swift-evolution mailing list