Hi all,
I find Parameters.jl and its function reconstruct() a very convenient way to handle models that need to be computed under many set of parameters. The feature that one can define a default value for a parameter that is a function of other parameters is really useful. However, consider the following:
using Parameters
@with_kw struct Para
a::Float64
b = a + 1
end
p = Para(a=1)
Which returns a struct with a = 1 and b = 2. Now if one uses reconstruct:
p2 = reconstruct(p,a=5)
I would like p2 to return a struct with a = 5 and b = 6, however it returns a struct with a = 5 and b = 2 (b is not updated to the new value of a). In my opinion, for most applications it would make much more sense that reconstruct makes b still consistent with the parameter a. Does anyone know any other option to achieve the desired result (in as simple and parsimonious way)?