I have a patch that implements this proposal *except* this part. (aka () ->
Void means 0 argument therefore { _ in } is a mismatch).
If we were to interpret tuple and the outer paren as described in this
proposal, it should be consistent everywhere, therefore requires more
consideration (separate proposal) and bigger change in the compiler.
Daniel Duan
Sent from my iPhone
> On Jul 5, 2016, at 2:07 PM, Jordan Rose <[email protected]> wrote:
>
>
>> On Jul 3, 2016, at 5:02, Vladimir.S via swift-evolution
>> <[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 SE-0029. IMO, going from (()) to () is a form
> of tuple splat.
>
> Jordan
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution