On 06.07.2016 0:07, Jordan Rose wrote:

On Jul 3, 2016, at 5:02, Vladimir.S via swift-evolution
<[email protected] <mailto:[email protected]>> wrote:

On 02.07.2016 4:20, Daniel Duan via swift-evolution wrote:
Vladimir.S via swift-evolution <swift-evolution@...> 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 
<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.

I believe this is not my "interpretation" but how the Swift 3.0 works right now and going from (()) to () is an edge case that we should discuss separately.

I understand your opinion, and probably you have correct interpretation of SE-0029, and probably current behavior of ()->Void vs (Void)->Void is just a long-running bug, but all that I want to achieve from this discussion - is to get clear reply regarding this question from core team / community like "yes, it is clearly decided and consensus was found, that current behavior is a bug and in Swift 3.0 it is will be not possible to send '()' aka Void to function defined as emtpy-parameters function. If you need to pass emtpy tuple to func - you'll need to define it as (Void)->Something".


Jordan
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to