-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name clash caused by submodels is hard to debug #427
Comments
julia> @model function test(n1, n2)
x1 ~ product_distribution(Fill(Uniform(), n1))
@submodel prefix=true y1 = linear(x1, 1, 1)
x2 ~ product_distribution(Fill(Uniform(), n2))
@submodel prefix=true y2 = linear(x2, 2, 2)
end
test (generic function with 2 methods)
julia> keys(SimpleVarInfo(test(5, 2)))
(x1, y1.y, x2, y2.y) So one alternative is to just to make the But improving error message seems more difficult 😕 |
Hi guys, We ran into the same issue around developing an epidemiological modelling/inference package (see here). Personally, I'd support |
Unfortunately it's a bit difficult to perform automatic prefixing in general because it's possible to put arbitrary expressions on the LHS of But what we can do, is to perform a check on the model before inference occurs to make sure nothing strange has occurred, and if it has, warn the user about it or error. This would then catch issues such as repeating varnames. |
|
Consider
test(5, 5)()
works, but probably erroneously. OTOH,test(5, 2)()
fails withwhich makes it really hard to find the root cause of the error unless you know what's going on in the internals (all manual checking for whether the arrays match is going fine!).
I guess this is the same as in any place when you use the same LHS twice, but isn't there some way to fail this more informatively?
The text was updated successfully, but these errors were encountered: