-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Eventually, we want to use VNT for everything in the world, including providing conditioning values.
However, with the current options (i.e. Dict), it's not possible to provide a template for array values;
model | Dict(@varname(x[1]) => 1.0, @varname(x[2]) => 1.0)when converting this Dict to a VNT, there is no template for x, so the behaviour may either be wrong, or it may issue spurious warnings.
Of course, a user can fix this by calling templated_setindex!! themselves, although that is slightly inconvenient. It would be nice to have a macro that looks something like this:
x = zeros(10, 10)
y = (; a=zeros(5))
vnt = @vnt begin
@template x, y
x[1] = 10.0
x[2, 5] = 20.0
y.a[1] = 30.0
z[2] = 40.0 # z has no template, so GrowableArray
endThis would desugar to a series of consecutive calls to templated_setindex!! or setindex!! as appropriate.
This would also be immensely helpful for writing tests, because it is a genuine pain to set up a templated VNT with lots of different things.