Hi!

I'm looking for the recommended way of getting type inference to
determine the number of elements passed via varargs.

I guess a code snippet is better than a thousand words: in the
following function, the type of a isn't inferred correctly.

function f(x...)
    N = length(x)
    a = Array{Int, N}()
    # ...
end

Using a wrapper function fixes the type instability:

g(x...) = g(x)
function g{N}(x::NTuple{N})
    a = Array{Int, N}()
    #
...
end

Is there a better solution than this workaround?


Regards

Reply via email to