<div dir="ltr">Thanks for your response. <div><br></div><div>The reason this doesn&#39;t work is due to Swift&#39;s generic system as it allows a type T to be a anything, including arrays. The example that was used to delineate this concept to me was that of &quot;Any...&quot;, which from within the variadic function, could be interpreted as T or [T]. The result is ambiguous in the current implementation, which is why some identifier syntax needs be passed along with an array to get this to work properly.</div><div><br></div><div>As for the choice of operator, I&#39;m open to suggestions. I wanted to use one that was familiar to other developers, so I chose the one that Ruby uses. </div><div><br></div><div>Maybe a ~ would be better, or a keyword like @variadic?</div><div><br></div><div><br></div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="color:rgb(0,0,0);font-family:helvetica,arial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif">Best,</span></div><div style="color:rgb(0,0,0);font-family:helvetica,arial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div style="color:rgb(0,0,0);font-family:helvetica,arial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif">Arthur / <a href="http://sabintsev.com/" target="_blank">Sabintsev.com</a> </span></div></div></div></div></div></div>
<br><div class="gmail_quote">On Sat, Dec 12, 2015 at 1:54 AM, Kevin Ballard via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>




<div><div>You can&#39;t use * as suggested, because that conflicts with * as a prefix operator.<br></div>
<div> </div>
<div>You could probably get away with using a trailing ... in the call, as in<br></div>
<div> </div>
<div>func foo(xs: [Int]...) {<br></div>
<div>    bar(xs...)<br></div>
<div>}<br></div>
<div> </div>
<div>I also wonder whether there&#39;s a reason Swift doesn&#39;t already support this. Maybe there&#39;s some desired future change to variadic arguments to improve performance (i.e. to avoid having to allocate an array) that wouldn&#39;t be compatible? Although I&#39;m not sure what that would be. Maybe there&#39;s actually no barrier at all and it was just something that wasn&#39;t prioritized. It would be good to know either way.<br></div>
<div> </div>
<div>-Kevin<br></div><div><div class="h5">
<div> </div>
<div>On Fri, Dec 11, 2015, at 10:43 PM, Arthur Sabintsev via swift-evolution wrote:<br></div>
</div></div><blockquote type="cite"><div><div class="h5"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Hi,<br></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"> </div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">I have put together a proposal for passing arrays to variadic functions (along the lines of Ruby’s Splay operator). <br></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"> </div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Proposal: <a href="https://github.com/ArtSabintsev/swift-evolution/blob/master/proposals/array-variadic-function.md" target="_blank">https://github.com/ArtSabintsev/swift-evolution/blob/master/proposals/array-variadic-function.md</a><br></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Pull Request: <a href="https://github.com/apple/swift-evolution/pull/52" target="_blank">https://github.com/apple/swift-evolution/pull/52</a><br></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Bug Report: <a href="https://bugs.swift.org/browse/SR-128" target="_blank">https://bugs.swift.org/browse/SR-128</a> which led to this proposal<br></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgb(0,0,0);margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"> </div>
<div> </div>
<div><div style="font-family:helvetica,arial;font-size:13px"><div style="color:rgb(34,34,34);font-family:arial,sans-serif">Best,<br></div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif"> </div>
<div><span style="color:rgb(34,34,34)"><span style="font-family:arial,sans-serif">Arthur / <a href="http://sabintsev.com" target="_blank">Sabintsev.com</a></span></span><br></div>
</div>
</div>
</div></div><div><img style="min-height:1px!important;width:1px!important;border-top-width:0px!important;border-right-width:0px!important;border-bottom-width:0px!important;border-left-width:0px!important;margin-top:0px!important;margin-bottom:0px!important;margin-right:0px!important;margin-left:0px!important;padding-top:0px!important;padding-bottom:0px!important;padding-right:0px!important;padding-left:0px!important" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/711f3e7b99078126bfee5afb315066b72e56b15a5729069b616122bbf989cc39/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3148765176786c673171614a7d2236454230345272776e4459394d22324158633668743373365a4d22364075573265543b6376796f48333566326679787673433d444435703d2232436837577577576254335d22324740393a774d4f69343d223643583474757f61753f64513e46324d453b657c41566d22364847734f42327c6949523170575858497a5d6648673836745472534a616876667a50746c6b4465603b6d223645524a6c4a607d6447566861746970595c463253396d22364f6242383f467477375176583961703d43576948397869695745687e674443347637424731417439586d2232476d23344d23344/open"><br></div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div> </div>

<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=QOj-2FXWMwrtGhHdk0ao-2FYqYPqIFSXRT0DG7Sea-2BCcxJNRliWsMChLuP-2Famg4xYgNg4ZkKFTm4w6seqmaFAFXN0Z9WwMdCydUROVYUxb2zvQ-2FHG6H7vu-2BQeVvyee9SFJREzNQk-2B58cPCRMHwDvSpd7pgd0nmDDl6vJzwjyAC-2FwAQs1-2FV70DE8FTRx0MRzo61f203BbiSUlZBDZuzvoFzTDF8y3KDabD-2BPvw4TmQlFoU5s-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>


<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">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></div><br></div></div>