Since empty arrays [] are of type Vector{None}, it will sometimes happen that people do mistakes like this:
julia> function f1(x::Vector{Int} = [])
true
end
f1 (generic function with 3 methods)
julia> function f2(; x::Vector{Int} = [])
true
end
f2 (generic function with 1 method)
julia> f1()
ERROR: no method f1(Array{None,1})
in f1 at none:2
julia> f2()
ERROR: no method __f2#3__(Array{None,1})
At least, in the second case, the function name is a bit weird. In the first case, the line number doesn't correspond to anything interesting. If it's possible, it would be great to print a more explicit message, like "default argument value is of an incorrect type".
Since empty arrays
[]are of typeVector{None}, it will sometimes happen that people do mistakes like this:At least, in the second case, the function name is a bit weird. In the first case, the line number doesn't correspond to anything interesting. If it's possible, it would be great to print a more explicit message, like "default argument value is of an incorrect type".