<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>You can't use * as suggested, because that conflicts with * as a prefix operator.<br></div>
<div>&nbsp;</div>
<div>You could probably get away with using a trailing ... in the call, as in<br></div>
<div>&nbsp;</div>
<div>func foo(xs: [Int]...) {<br></div>
<div>&nbsp; &nbsp; bar(xs...)<br></div>
<div>}<br></div>
<div>&nbsp;</div>
<div>I also wonder whether there's a reason Swift doesn't already support this. Maybe there's some desired future change to variadic arguments to improve performance (i.e. to avoid having to allocate an array) that wouldn't be compatible? Although I'm not sure what that would be. Maybe there's actually no barrier at all and it was just something that wasn't prioritized. It would be good to know either way.<br></div>
<div>&nbsp;</div>
<div>-Kevin<br></div>
<div>&nbsp;</div>
<div>On Fri, Dec 11, 2015, at 10:43 PM, Arthur Sabintsev via swift-evolution wrote:<br></div>
<blockquote type="cite"><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;">&nbsp;</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).&nbsp;<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;">&nbsp;</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:&nbsp;<a href="https://github.com/ArtSabintsev/swift-evolution/blob/master/proposals/array-variadic-function.md">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:&nbsp;<a href="https://github.com/apple/swift-evolution/pull/52">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:&nbsp;<a href="https://bugs.swift.org/browse/SR-128">https://bugs.swift.org/browse/SR-128</a>&nbsp;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;">&nbsp;</div>
<div>&nbsp;</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;">&nbsp;</div>
<div><span class="colour" style="color:rgb(34, 34, 34)"><span class="font" style="font-family:arial, sans-serif">Arthur /&nbsp;<a href="http://sabintsev.com">Sabintsev.com</a></span></span><br></div>
</div>
</div>
<div><img style="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">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div>&nbsp;</div>
</body>
</html>