> On 20 Apr 2016, at 13:10, Haravikk <[email protected]> wrote:
> 
> 
>> On 20 Apr 2016, at 11:44, Jeremy Pereira <[email protected]> 
>> wrote:
>>> Pros:
>>>     • Slightly cleaner syntax at call-site.
>>>     • Possibly optimisations unavailable to Array passing?
>> 
>> • Makes calling C and Objective-C functions with variadic parameters less 
>> confusing
>> • Will not break existing Swift code that uses variadic parameters
> 
> In both cases you just have to add square brackets to make it an array 
> instead, which doesn’t seem more confusing to me since that’s actually what 
> you’re doing anyway.

But you still have to do it and a call to (say) printf would look different to 
its C declaration. Each individual change may not be onerous but you advocating 
something that will cause an annoyance to a lot of people for a highly 
subjective gain.

> 
>> • Makes generalising some functions cleaner e.g. zip(a, b) could be 
>> generalised to any number of parameters as already mentioned, but if you 
>> instead used an array, we would end up with a massive thread about whether 
>> the original two parameter zip should be removed
> 
> Only if the two-parameter form isn’t implemented any differently;

Why would it be implemented differently?

>> My quick an uscientific survey of questions and answers relating to variadic 
>> parameters on StackOverflow yields no instances of people asking what does 
>> the`…` in `func foo(a: Int…)` do which suggests that the learning curve is 
>> actually fairly trivial. However their is a megaton of questions asking 
>> things like “why can’t I pass an array" and "how do I forward variadic 
>> arguments to another variadic function”.
> 
> The ellipsis syntax is straightforward enough, but I think the problem lies 
> more with variadics that overload similar function signatures (like the zip() 
> method) where it becomes less clear what you’re calling, and what’s happening 
> in that call (even if the actual method is pretty much the same). Passing 
> arguments on also couldn’t be simpler in the array form, as you simply pass 
> the array into another function that can take one.

I’m not against the idea of an addition to the language that would create a 
mechanism to allow passing arrays to variadic functions. I’m simply against the 
idea of removing the existing feature. As far as I can see, the only arguments 
put forward are “it might be confusing” and “I don’t like it". I think the bar 
should be higher than that
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to