FunctionWrappers and kwargs

I see FunctionWrappers.jl as a critical tool to enable precompilation of code that takes functions as inputs, and hence reduce latency in such cases. I think the package is a crucial tool in the Julia language, since there is no other way to do what it does as far as I can tell. (I’m actually worried to see it remain for so long in an “Experimental” status, actually.)

One of the issues that merits the “experimental” tag, I guess, is that it doesn’t allow wrapping arbitrary functions, e.g. Vararg functions. I’m ok with that: the whole point of a FunctionWrapper is to have a well defined type of the input and output of a function. What I find more problematic is that I cannot pass keyword arguments, as far as I can tell…

julia> using FunctionWrappers

julia> f = FunctionWrappers.FunctionWrapper{Int,Tuple{Int}}((x; p = 2) -> p * x)
FunctionWrappers.FunctionWrapper{Int64, Tuple{Int64}}(Ptr{Nothing} @0x00000001183aeb90, Ptr{Nothing} @0x000000010e83c018, Base.RefValue{var"#17#19"}(var"#17#19"()), var"#17#19")

julia> f(2)

julia> f(2; p = 3)
ERROR: MethodError: no method matching (::FunctionWrappers.FunctionWrapper{Int64, Tuple{Int64}})(::Int64; p=3)
Closest candidates are:
  (::FunctionWrappers.FunctionWrapper)(::Any...) at /Users/pablo/.julia/packages/FunctionWrappers/8xdVB/src/FunctionWrappers.jl:137 got unsupported keyword argument "p"
 [1] top-level scope
   @ REPL[26]:1

Question: is there any way to make something like the above work?

Just to clarify, the ultimate goal here is to have a wrapper f::FunctionWrapper{...} of a concrete type (regardless of the wrapped function, assuming it has a fixed signature but arbitrary kwargs) that can thus be passed to precompile to reduce latency.