Passing on function keyword collections in 0.7

I have a function with multiple methods and one of those methods just prepares an input to pass it on to the main method. How do I pass on all the keyword arguments in 0.7?

Here is a simple example.

julia> arg_test(test::Array{T,1};a=1,b=42) where T <: String = (test,a,b)
julia> arg_test(test::String;kwargs...) = arg_test([test],kwargs...)
julia> arg_test("Hello World",b=0)

ERROR: MethodError: no method matching arg_test(::Array{String,1}, ::Pair{Symbol,Int64})
Closest candidates are:
  arg_test(::Array{T<:String,1}; a, b) where T<:String at REPL[1]:1
Stacktrace:
 [1] #arg_test#4 at ./REPL[2]:1 [inlined]
 [2] (::getfield(Main, Symbol("#kw##arg_test")))(::NamedTuple{(:b,),Tuple{Int64}}, ::typeof(arg_test), ::String) at ./none:0
 [3] top-level scope at none:0
arg_test(test::String;kwargs...) = arg_test([test]; kwargs...)
2 Likes
julia> g(;a=2) = a
g (generic function with 1 method)

julia> f(x; kwargs...) = g(;kwargs...)
f (generic function with 1 method)

julia> f(2, a=3)
3

Edit: Meh, too slow…

1 Like

I tried so many variations I can’t believe that wasn’t one of them.

The built-in facepalm is not enough…

https://www.geek.com/wp-content/uploads/2014/06/picard-facepalm-face-palm.jpg