julia> vnt1 = @vnt begin x = [1.0, 2.0] end
VarNamedTuple
└─ x => [1.0, 2.0]
julia> vnt2 = @vnt begin
@template x = zeros(2)
x[1] = 3.0
end
VarNamedTuple
└─ x => PartialArray size=(2,) data::Vector{Float64}
└─ (1,) => 3.0
julia> merge(vnt1, vnt2)
VarNamedTuple
└─ x => PartialArray size=(2,) data::Vector{Float64}
└─ (1,) => 3.0
It is a bit unintuitive that x[2] is dropped here. This happens because merge can't line the two up: it just thinks "okay, one is a PA and one is an array and they're different things, so I'll just overwrite the first one". I don't really know what the solution to this is.
It is a bit unintuitive that
x[2]is dropped here. This happens becausemergecan't line the two up: it just thinks "okay, one is a PA and one is an array and they're different things, so I'll just overwrite the first one". I don't really know what the solution to this is.