<div dir="ltr">+1 if SE-0111 is accepted. 0 otherwise. </div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 1, 2016 at 7:34 PM, Vladimir.S via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 02.07.2016 1:49, Daniel Duan via swift-evolution wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Chris Lattner via swift-evolution <swift-evolution@...> writes:<br>
<br>
I think there's an edge case that needs consideration: when there's zero<br>
expected arguments and the '_' parameter is used:<br>
<br>
let f: () -> Void = { _ in }<br>
</blockquote>
<br></span>
As I understand current syntax and logic, there is *one* expected argument : Void. This is why we can call f(()). But we are allowed to omit that empty tuple parameter in syntax(on caller side and in function parameter list definition). So, IMO or this should be leaved as is, or we should move away from association between Void and "emptiness" of parameters(I don't understand if this is possible).<br>
<br>
If we'll disallow this, will that be allowed:<br>
<br>
func foo(_ x: Void) { print(x) }<br>
<br>
foo()<br>
<br>
and then question regarding<br>
<br>
typealias MyFunc<T> = (T) -> Void<br>
<br>
let myfunc1 : MyFunc<Int> = {i in print(i)}<br>
let myfunc2 : MyFunc<String> = {s in print(s)}<br>
let myfunc3 : MyFunc<Void> = {_ in print("nothing")}<br>
<br>
<br>
Probably there is no problem with current behavior for empty tuple(Void) as soon as *one* parameter will be mapped to the same *one* argument(or zero arguments for this very special case).<br>
<br>
Btw, don't we want to stop these games with recursive empty tuples:<br>
<br>
foo(())<br>
foo(((())))<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
According to the proposal, this is syntactically incorrect ( 0 != 1 ). But it<br>
is legal now since '_' matches up with the empty tuple. Is there value to keep<br>
it legal?<br>
<br>
Either way, this may remain an implementation detail. But it might be<br>
beneficial to make it explicit in the proposal.<br>
<br>
- Daniel<br>
<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
</blockquote>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>