@tshort, I am back to this issue after a while. I am giving NamedTuple a try, but couldn’t make the outer constructor below work:
using Parameters: @with_kw
@with_kw struct Param
mean = 0.
variance = 1.
end
struct Solver
params::Dict{Symbol,Param}
# inner ctor to be called from outside
Solver(params::Dict{Symbol,Param}) = new(params)
end
# outer ctor with named tuples
function Solver(params...)
dict = Dict{Symbol,Param}()
for (varname, varparams) in params
push!(dict, varname => Param(varparams...)) # doesn't work
end
Kriging(dict)
end
Could you please give a hand? The goal is to have the Solver working with named tuples as you described:
Solver(:var1 => @NT(mean=1), :var2 => @NT(variance=2.))