<div dir="ltr">On Mon, Jun 12, 2017 at 2:56 PM, Jérémie Girault <span dir="ltr"><<a href="mailto:jeremie.girault@gmail.com" target="_blank">jeremie.girault@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">@Xiaodi Wu</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Disagree, and we would need the original designer here to help us, but my understanding of the original meaning of tuples-as-arguments is that when I define:</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">`func foo(_ arg0: Any, _ arg1: Any) {}`</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">I can afterwards “apply” a tuple to a function named `foo` and therefore execute the function on this tuple.</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Calling a function syntax was equivalent to put a tuple next to a function name:</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">`foo(42, “hello")` the left-hand is `foo`, the right-hand is `(42, “hello")` is the tuple.</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">The same way if I have</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">`func foo()`</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">`foo()` means calling `foo` with argument `()` and there we have our original `Void`</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">That meaning changed recently due to multiple SE implementations actually.</div></div></blockquote><div><br></div><div>Tuples-as-arguments never shipped in any version of Swift, and the ability to "apply" a tuple like that was removed by SE-0029--the original goal was to implement this change in time for Swift 2.2.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">The parenthesis around the call don't have a tuple meaning anymore. Therefore it breaks a lot of code relying on this feature of the language, which was quite elegant, but could not handle advanced functions features.</div></div></blockquote><div><br></div><div>Yes, this is an intentional and approved part of SE-0029. The drawbacks were enumerated in that proposal and were deemed acceptable.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">@john: Void can happen easily in parameters due to generics, the easiest example that breaks with swift4 is</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">`typealias Callback<T> = (T) -> Void`</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">here</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">`Callback<Void>` which is perfectly reasonable introduces Void in the argument list and forces the caller to introduces an empty partenthesis set when invoking:</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">```</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">let foo: Callback<Void> = { }</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">foo(())</div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">```</div></div></blockquote><div><br></div><div>`Callback<T> = (T) -> Void` refers to a callback that takes exactly one argument. Since argument lists are not tuples, it is not possible to invoke such a callback with zero arguments, or for that matter with two, three, four, or five arguments.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"></div><div id="m_-2321952076676033477bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">That’s were the proposal shines in my opinion: adapting the meaning of Void to the current context of swift4 gives back the language the elegant syntax it had while preserving the type system</div></div></blockquote><div><br></div><div>I'm not sure what you mean by this. No change in `Void` can cause a function of type (T) -> Void to accept zero arguments: it requires one argument of type T.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><div id="m_-2321952076676033477bloop_sign_1497296119954916864" class="m_-2321952076676033477bloop_sign"><div style="font-family:helvetica,arial;font-size:13px"><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:small">On 12 juin 2017 at 20:04:18, Xiaodi Wu (</span><a href="mailto:xiaodi.wu@gmail.com" target="_blank" style="font-family:arial,sans-serif">xiaodi.wu@gmail.com</a><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:small">) wrote:</span><br></div></div></span><div><div class="h5"> <blockquote type="cite" class="m_-2321952076676033477clean_bq"><span><div><div></div><div>
<div>On Mon, Jun 12, 2017 at 12:44 Jérémie Girault <<a href="mailto:jeremie.girault@gmail.com" target="_blank">jeremie.girault@gmail.com</a>>
wrote:<br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<p>Void was the empty tuple because arguments were tuples.</p>
</div>
</div>
</blockquote>
<div><br></div>
<div>As John explained, that is _not_ correct. Void was not
motivated by anything to do with argument lists.</div>
<div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<p>So no arguments meant empty tuple.</p>
<p>If we consider the empty tuple to be an argument, then the type
for the type of empty tuple should be `Unit`</p>
</div>
</div>
</blockquote>
<div><br></div>
<div>It has been suggested to rename Void to Unit. I do believe
it’s on the commonly rejected ideas list (and if it’s not, it ought
to be).</div>
<div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<p>Void, however, seem naturally fitted for the absence of
argument.</p>
<p>Should `func foo(Void)` be different from `func foo()`?</p>
</div>
</div>
</blockquote>
<div><br></div>
<div>SE-0110 determined that the two should in fact be
different.</div>
<div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<p>I don’t think so. But different from `func foo(Unit)` ? Yes
!</p>
</div>
</div>
</blockquote>
<div><br></div>
<div>It sounds like your quarrel is with the name of the typealias.
I don’t see how that solves any issues with the loss of tuple
splatting. Functions will still return (), and you foo(()) is not
foo().</div>
<div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<p>My point here is that we probably won’t have splatting for
swift4.</p>
<p><br></p>
</div>
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
But if we consider the type system as a guide, we can consider 3
simple set of rules and restore almost 100% source compatibility
while keeping the improvement of SE-0110</div>
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
- Rules for swift3 tuples-arguments of cardinality zero (Void) in
swift 4 (this proposition)</div>
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
- Rules for swift3 tuples-arguments of cardinality one in swift 4
(proposition to be done)</div>
<div id="m_-2321952076676033477m_5965133149641952769bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
- Rules for swift3 tuples-arguments of cardinality > 1 in swift
4 (proposition to be done)</div>
</div>
<div style="word-wrap:break-word"><br>
<div id="m_-2321952076676033477m_5965133149641952769bloop_sign_1497288880940260864" class="m_-2321952076676033477m_5965133149641952769bloop_sign">
<div style="font-family:helvetica,arial;font-size:13px">—</div>
<div><font face="Helvetica" size="1">very short reply expected -
<a href="http://vsre.info" target="_blank">vsre.info</a></font></div>
<div style="font-family:helvetica,arial;font-size:13px">Jérémie
Girault<br></div>
</div>
<br></div>
<div style="word-wrap:break-word">
<p class="m_-2321952076676033477m_5965133149641952769airmail_on">On 12 juin 2017 at
19:25:31, Xiaodi Wu (<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>) wrote:</p>
<div>
<blockquote type="cite" class="m_-2321952076676033477m_5965133149641952769clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div>
<div>
<div><span>Unfortunately, I think this proposal appears to be
mistaken as to this key premise: Void was never (IIUC) meant to
model the absence of arguments; it is a type with one possible
value.</span></div>
</div>
</div>
</blockquote>
</div>
<div>
<div>
<blockquote type="cite" class="m_-2321952076676033477m_5965133149641952769clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div>
<div>
<div><span><br>
<br>
If I recall, a number of conversations have been raised about Void
being a typealias of (), and the definitive response has been that
this falls into the ship-has-sailed category of out-of-scope
changes.<br>
<br>
More generally, the recent spate of complaints about regressions to
a particular coding style have to do with loss of implicit tuple
splatting, the cure for which is a proper implementation of tuple
splatting, not poking holes into settled parts of the type
system.</span></div>
</div>
</div>
</blockquote>
</div>
<div>
<blockquote type="cite" class="m_-2321952076676033477m_5965133149641952769clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div>
<div>
<div><span><br class="m_-2321952076676033477m_5965133149641952769Apple-interchange-newline">
<br></span></div>
<div><span><br></span>
<div class="gmail_quote">
<div><span>On Mon, Jun 12, 2017 at 12:15 John McCall via
swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>>
wrote:<br></span></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div style="word-wrap:break-word"><span><br></span>
<div>
<blockquote type="cite">
<div><span>On Jun 12, 2017, at 4:48 AM, Jérémie Girault via
swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>>
wrote:</span></div>
<span><br class="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274Apple-interchange-newline">
</span>
<div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span>Hi here,</span></div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span><br></span></div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span>As I tested swift4 in xcode9b1 I noticed a lot of regressions
about tuples usage.</span></div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span><br></span></div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span>After documenting myself about the changes which happened, I
thought that they could be improved. Instead of fighting these
propositions (which make sense), I wanted create a few proposal
which would improve these recent changes with a few simple
rules.</span></div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span><br></span></div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span>My propositions are based on the recent decisions and in the
continuation of SE-0110. The first one is about Void.</span></div>
<div id="m_-2321952076676033477m_5965133149641952769m_7884169765734884326m_-2000047954192297274bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">
<span>Void is historically defined as the type of the empty tuple.
The reason of this is that arguments were initially considered as
tuple.</span></div>
</div>
</blockquote>
<span><br></span></div>
</div>
<div style="word-wrap:break-word">
<div><span>The dominant consideration here was always return types,
not parameters. I'm not sure there was ever much point in
writing Void in a parameter list, but whatever reasons there were
surely vanished with SE-0066.</span></div>
<div><span><br></span></div>
<div><span>Note that 'void' in C was originally exclusively a
return type. ANSI gave it a new purpose it with void*, but
the meaning is totally unrelated.</span></div>
</div>
<div style="word-wrap:break-word">
<div><span><br></span></div>
<div><span>John.</span></div>
</div>
<span>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
</span></blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div></div></span></blockquote></div></div></div>
</blockquote></div><br></div></div>