There have been a lot of proposals about this over the years. One alternative solution (forgive me for not giving credit here I found a thread about it and another one) would be making variadic syntax just an alternative way of writing an argument to a function. I can think of a couple of different ways of accomplishing this, here's a sketch of one:
func f(_ s: @variadic Set<Int>) { … }
let s: Set<Int> = [1, 2, 3]
f(s) // current syntax with set
f([1, 2, 3]) // current syntax with array literal
f(1, 2, 3) // variadic syntax
Then Int...
can just become syntactic sugar for @variadic [Int]
, and perhaps be deprecated if that is considered desirable. This would allow you to directly construct any ExpressibleByArrayLiteral
type in cases where something other than an Array
is required, and automatically handles the issues with the incompatibility between Int...
and [Int]
in cases like the ones mentioned in this thread.
Edit: Now I've found the threads about this, I remember that there are some issues around ambiguity here that would have to be solved, but I don't think it's fatally flawed.