[swift-evolution] [Idea] Passing an Array to Variadic Functions

Brent Royal-Gordon brent at architechies.com
Mon Apr 18 17:25:27 CDT 2016


> All those points are also perfectly solved by dependent types

How? What does print() or max() or ArrayLiteralConvertible have to do with dependent types?

And what makes you think we're going to get dependent types, anyway?

> I very very rarely use the print function with multiple parameters. Most of the time I build a single string and use string interpolation to insert values. If there really is a need for multiple arguments to print, like others said, overloads could be generated.

How many? What will that do to the type checker, which can go exponential on the number of overloads?

> min and max: I think most the time they are used to compare 2 values. If there are more than 2 values (or let’s say 3) I think an array is better suited.

Why do you think an array is better suited?

> String.init(format:_:) … I think if all C APIs would get imported by converting varargs to arrays we could get rid of it.

Are you sure that's actually possible?

And ultimately, why are you so eager to remove this feature? Is there something wrong with it?

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list