<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 6 Jul 2016, at 21:13, David Rönnqvist via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I'd be reluctant to remove variadic parameters. We've found on our team that variadic arguments are easier to read on the call site compared to array arguments, especially when it's common to pass a single value (but still possible to pass multiple values).<br class=""><br class="">- David</div></div></blockquote><br class=""></div><div>I'm very much in the remove-them camp, however I do wonder if there might be another way to handle them? In other words, when defining a method we should always define an array, but perhaps we could use an attribute to selectively turn any Sequence or Iterator parameter into a variadic, like-so:</div><div><br class=""></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>func someMethod(@variadic _ values:[Int]) { … }</font></div><div><br class=""></div><div>This can be called using the developers preference between:</div><div><br class=""></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>someMethod([1, 2, 3, 4, 5, 6])</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>someMethod(1, 2, 3, 4, 5, 6)</font></div><div><br class=""></div><div>So long as there's no ambiguity of course. This should have a few advantages over the current variadics:</div><div><br class=""></div><div><ul class="MailOutline"><li class="">No unique declaration syntax</li><li class="">Reinforces that a variadic function is just a function taking some kind of Collection</li><li class="">Enables us to choose the type of the parameter from any Iterator, Sequence or Collection.</li><li class="">Allows developers to choose the function's form at the call-site between passing a collection/sequence/iterator or a list of values. Also an array literal if the chosen type supports that as in the example above.</li><li class="">Allows passing of an array literal or appropriate Collection type.</li><li class="">An attribute is more discoverable (option-click in Xcode to view documentation).</li></ul><div class=""><br class=""></div><div class="">Any got any thoughts on this alternative?</div></div></body></html>