I think I got it. I pass in named tuples for arguments, observations, and parameters. Then in the generated function, I push some lines like
:($k::$T = _pars.$k)
I thought maybe I needed to get rid of the type annotation, but I think it might work out better to make sure the variable is treated as local. So I added
for k in keys(args) ∪ keys(pars) ∪ keys(data)
push!(loader.args, :(local $k))
end
and I think that fixes things. Thanks all for the helpful discussion :smile:
Chad Scherrer has marked this topic as resolved.
Last updated: Oct 02 2023 at 04:34 UTC