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
[BUG] Constructor function uses setParameter instead of class constructors #391
Comments
This is the source of issue #348. |
Perhaps a more generic solution would modify how a ConstructorFunction works? Or, even more generally, we could express some types (like
Looking at the Probability class in
Only the first way checks the value. We could certainly add a check to |
Any further thoughts on this? My take would be that for now, an inelegant fix is probably better than keeping the error in until we get around to restructuring the whole type system (which unfortunately really is a mess; see also issue #308). Happy to open a quick PR for this if that's what we agree to do. |
Yeah, in practice would should probably fix it new, even before we have a wider solution. You may as well prepare a PR. @bjoelle Do you have any ideas about a "more generic solution"? Perhaps one that is less invasive than the one I mentioned? |
so my ideas on a more generic solution would be
|
I encountered this while tracking down why
a = Probability(-1)
works when the checks in the class constructors should block thatbasically
ConstructorFunction::execute
inConstructorFunction.cpp
builds the class from a template and then calls setParameter or setConstParameter, andProbability::setConstParameter
has no checks on the value passed to itwe could solve the specific issue by adding checks to
Probability::setConstParameter
but this seems like a problem that should have a more generic solutionThe text was updated successfully, but these errors were encountered: