[swift-evolution] [pitch] Variadic Arguments should accept Arrays
2th at gmx.de
Sat Mar 11 03:47:01 CST 2017
>>> foo(["a", "b", "c"] as String...)
>> I like this
I really don't get this:
We have methods like NSLayoutConstraint.activate(_ constraints: [NSLayoutConstraint]), which works with an array, declares its parameter to be array and is called with an array. Quite simple.
On the other hand, we have functions which work with an array, but are declared with Type…, and are called with a comma-separated list of elements — and we should add an option to call this function (which works on array!) with an array that is decorated with a strange cast?
That looks extremely awkward to me.
Can I declare a variable like
var list: String… = "a"
Imho it's better to get rid of these odd types completely.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution