<div dir="ltr">Jaden,<div><br></div><div>That's a good point.<br><br>In C#, variadic parameters explicitly stated to be arrays.</div><div><br>This means that in C#, this never occurs because:<br>foo(params int[] bar)<br>has the same signature as<br>foo(int[] bar)<br><br>Thus, you can't have both commands defined as they're identified to be conflicting overloads. In fact, it's what allows you to simply pass an int array to foo(params int[] bar).<br><br>The params keyword basically just specifies to be an accumulator for multiple parameters.<br><br>Meanwhile, in Swift you can have a single class with all of the following:<br>foo(bar: Int)<br>foo(bar: Int...)</div><div>foo(bar: [Int])<br><br>For the syntax to work without a #splat operator, methods with Int... and [Int] would have to be considered as equivalent signatures.</div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 20, 2016 at 12:56 PM <<a href="mailto:jaden.geller@gmail.com">jaden.geller@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Sure, but imagine it weren't generics. Instead, we have two specialized functions, the first identical the generic one with T = Int and the second with T = [Int]. We have the same problem again.</div><div><br>Jaden</div></div><div dir="auto"><div><br>On May 20, 2016, at 9:50 AM, Christopher Boyd <<a href="mailto:xpboyd@gmail.com" target="_blank">xpboyd@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div style="white-space:pre-wrap">Jaden,<br><br>In that very specific example with generics, couldn't you just explicitly specify foo<[T]>(bar: bar)?</div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 20, 2016 at 12:39 PM <<a href="mailto:jaden.geller@gmail.com" target="_blank">jaden.geller@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Without it, there could be ambiguity. Observe:</div><div><br></div><div>func foo<T>(bar: [T]...) {</div><div> foo(bar: bar) // splat or pass single arg?</div><div>}</div><div><br></div><div>- Jaden Geller<br>Sent from my iPhone</div></div><div dir="auto"><div><br>On May 20, 2016, at 9:29 AM, Christopher Boyd via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Vladimir,<br><br>True, but does the extra syntax actually accomplish anything?<br><br>From my example:<div><ul style="color:rgb(33,33,33);font-family:'helvetica neue',helvetica,arial,sans-serif"><li style="font-family:helvetica,arial,sans-serif;font-size:14px;line-height:22.4px;border-width:0px 0px 0px 18px;border-left-style:solid;border-left-color:transparent;margin:0px;outline:0px;padding:0px 10px 0px 0px;vertical-align:baseline;white-space:pre-wrap;list-style-type:none;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial"><code style="border:0px;font-size:0.85em;margin:0px;outline:0px;padding:0px;vertical-align:baseline;font-family:menlo,monospace;word-wrap:break-word;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial"><span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(170,51,145);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">func</span> <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(63,110,116);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">arithmeticMean</span>(<span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(63,110,116);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">numbers</span>: <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(92,38,153);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">Double</span>...) -> <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(92,38,153);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">Double</span> {</code></li><li style="font-family:helvetica,arial,sans-serif;font-size:14px;line-height:22.4px;border-width:0px 0px 0px 18px;border-left-style:solid;border-left-color:transparent;margin:0px;outline:0px;padding:0px 10px 0px 0px;vertical-align:baseline;white-space:pre-wrap;list-style-type:none;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial"><code style="border:0px;font-size:0.85em;margin:0px;outline:0px;padding:0px;vertical-align:baseline;font-family:menlo,monospace;word-wrap:break-word;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial"> <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(170,51,145);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">return</span> <span style="color:rgb(63,110,116);font-size:11.9px;line-height:22.4px">add</span><span style="font-size:11.9px;line-height:22.4px">(</span><span style="font-size:11.9px;line-height:22.4px;border:0px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(63,110,116);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">numbers</span><span style="font-size:11.9px;line-height:22.4px">)</span> / <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(63,110,116);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">Double</span>(<span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(63,110,116);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">numbers</span>.<span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(63,110,116);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">count</span>)</code></li><li style="font-family:helvetica,arial,sans-serif;font-size:14px;line-height:22.4px;border-width:0px 0px 0px 18px;border-left-style:solid;border-left-color:transparent;margin:0px;outline:0px;padding:0px 10px 0px 0px;vertical-align:baseline;white-space:pre-wrap;list-style-type:none;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial"><code style="border:0px;font-size:0.85em;margin:0px;outline:0px;padding:0px;vertical-align:baseline;font-family:menlo,monospace;word-wrap:break-word;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">}</code></li></ul></div><div><br></div><div>It's clear that the intent is to pass all the numbers to add().<br><br>What, exactly, does adding the #splat() syntax achieve? It doesn't add any additional clarity.<br><br>Moreover, I don't think #splat has been accepted as a proposal yet.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 20, 2016 at 12:19 PM Vladimir.S <<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[offtopic]<br>
On 20.05.2016 19:08, Christopher Boyd via swift-evolution wrote:<br>
> Certainly, #splat would work, but it may be slightly more confusing to<br>
> someone that hasn't seen the splat operator before:<br>
So, he/she will open swift documentation or drop the question to google<br>
once, and from that moment will know what #splat means.<br>
[/offtopic]<br>
</blockquote></div>
</div></blockquote></div><div dir="auto"><blockquote type="cite"><div><span>_______________________________________________</span></div></blockquote></div><div dir="auto"><blockquote type="cite"><div><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></blockquote></div>
</div></blockquote></div></blockquote></div></div></div>