[swift-evolution] [Review] SE-0110: Distinguish between single-tuple and multiple-argument function types

Jordan Rose jordan_rose at apple.com
Tue Jul 5 16:07:21 CDT 2016

> On Jul 3, 2016, at 5:02, Vladimir.S via swift-evolution <swift-evolution at swift.org> wrote:
> On 02.07.2016 4:20, Daniel Duan via swift-evolution wrote:
>>> Vladimir.S via swift-evolution <swift-evolution at ...> writes:
>> Following your conclusion, should this be legal as well?
>> let f: () -> Void = { x in print(x) } // f() prints "()"
>> let f: (Int) -> Void = { x in print(x) } // f(5) prints "5"
>> In other words, "0 argument" is an impossible scenario?
> I don't see problems here. ()->Void means (Void)->Void, there *is* one parameter of Void type, which we can omitted as it is empty tuple. So, if you want you can write f(()) or or let z = (); f(z); or just f(), so in closure definition you can have one argument or can have 0 defined arguments if the only argument is of type Void.

I already said this on the bug you filed, but I disagree quite strongly with this interpretation, based on SE-0029 <https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md>SE-002 <https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md>9. IMO, going from (()) to () is a form of tuple splat.

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

More information about the swift-evolution mailing list