-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Issue with shadowing and binary functions #997
Comments
For the record, I would go with a) if its easy to implement, if not then c). |
I think I would do (b) here, all of the functions available through stan and |
I am not so sure we are supporting all signatures in Math at the moment. At least in the past we had a few things like pow(int, int). But maybe we cleaned that up. But yeah, there are not that many std:: function and we might as well just check them all. |
@SteveBronder did you ever get a chance to look into this? |
We currently have this chunk of code: stanc3/src/stan_math_backend/Expression_gen.ml Lines 8 to 18 in 8429968
Which I believe is why the unary functions still do compile (though it seems outdated/wrong, |
This is a continuation of the discussion with @WardBrian here: #995 (comment)
Long story short, this model's generated code fails to compile:
with
We allow shadowing and it works with nullary and unary functions. For example this model works fine:
Solutions to this are:
a) add
stan::math
namespace to a function if there is a variable with the same name used in the modelb) add
stan::math
namespace to all Stan Math function calls (this probably doesnt work as we may fallback to std:: in some cases)c) if a function is shadowed it can no longer be used as a function in that model (@WardBrian mentioned this is what Python does)
d) disallow shadowing for binary functions (we have to check functions with 3+ args as well)
This is not a new issue for this release, its been present since we allowed shadowing.
The text was updated successfully, but these errors were encountered: