The whole idea is to have a struct where I have the same fields but different “defaults” where then users can change something punctual (a few parameters) relative to these “defaults”.
I am fine with your solution, I just need to find now a way to “automatically” get the keyword arguments of a function.
For example, in:
function foo(;
x = 5,
y = [10,20,30],
z = x .+ (2 .* y) ,
kwargs...)
p = printme(;x=x,y=y,z=z,kwargs...)
return p
end
function printme(;kwargs...)
for (k,v) in kwargs
println("$k: $v")
end
end
foo(;x=10, a=1,b="a")
How to avoid typing “x=x,y=y,z=z” ? Is there a macro that provides the keyword arguments (used or not) of a function ?
I can see this old thread, but here I need it inside the function itself, so using that method would lead likely to infinite recursion…