JuliaLang/julia — comment on commit a6dc8c5470d4a9e3bef42f5a116a4241d0db6fa0
File: j/set.j line 33
By JeffBezanson:

I have to say I'm really not a fan of this, passing all elements of a data structure as arguments to a function. It's an abuse of varargs. In theory, this is limited by available stack space so it doesn't have to work for big sets. I know you want this optimized so that the data structure is passed with no copying, but it's not likely to happen. It requires compiling a separate version of each varargs function that accepts its arguments from a data structure rather than on the stack, and the fact that such a call is happening has to be propagated through the system at high complexity cost. We'd have to do the optimization every time, not just "when we can", otherwise you don't know whether it's safe to splice a large data structure. And, all arguments count for dispatch, so in general there is no way to avoid looking into the data structure first.

And of course f(a..., b..., c...) can happen too. Nice syntax is the problem. The dots are too tempting.

I think there has to be an `add_each` function instead, or just use a for loop at the call site.