Yes you are correct. @set
alone won’t work - the tuple doesn’t get changed when you call it again. I saw this thread explaining how to make it work with the BangBang package though. For example:
julia>using BangBang
julia> ParamTupl = @with_kw (α = 0.5, β = 0.9)
##NamedTuple_kw#257 (generic function with 2 methods)
julia> p = ParamTupl()
(α = 0.5, β = 0.9)
julia> @set p.β = 0.7
(α = 0.5, β = 0.7)
julia> p
(α = 0.5, β = 0.9)
# now with BangBang
julia> @set!! p.β = 0.7
(α = 0.5, β = 0.7)
julia> p
(α = 0.5, β = 0.7)
The main advantage with named tuples is that you don’t have to specify types to get optimizations to work so in that sense they may be a bit more user friendly. Not sure there are advantages beyond that.