-
Notifications
You must be signed in to change notification settings - Fork 41
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
Can AssertionLevel change dynamically? #2642
Comments
The example is a bit silly. Obviously this influences the noEvent-handling, but that is already being discussed with no consensus and a unevaluated parametric assertionLevel have the similar issue; as noted in #2571 |
To be a bit contrary, there is nothing in the specification stating that the assertion level can be anything but a literal either. In fact, the specification only explains what happens if The example at the end of the section does show that the non-literal case is not needed, and seems much cleaner than throwing in more conditions in something that is not the condition argument. |
I have nothing against an expression at assertionLevel, but this must be evaluatable at compile time, in general it should have at least parameter variability. The reason is, that the compiler can handle both cases differently. In case of |
Right, I think the intention here was to clarify that the assertion level is a "structural parameter". |
To me specifying that arguments are evaluated for all primitives seem a bit unnecessary, and we should mostly assume that they are evaluated. Assert also says "If the condition of an assertion is true, message is not evaluated and the procedure call is ignored." It doesn't say "If the condition of an assertion evaluates to true."
We can certainly state that. I don't see any major problems with it. |
Sounds good. This would make the originally given example invalid, since it has an assertion level with a higher variability than parameter. |
Poll (can be in favor of more than one):
|
In
ModelicaCompliance.Equations.Assert.AssertVarLevel
we have:How should one read this test?
A: The
shouldPass = false
means this is against the specification, and a tool should reject it.B: The documentation string and and the assert
message
describe what is expected to happen, and a tool should handle this model, issuing first a warning attime = 0.5
, then an error attime = 0.6
.I would vote for A, and only allow literals in the
level
of anassert
. The example at the end of 8.3.7 seems to indicate using two separate asserts for this use case is the recommended way.If we allow B, what happens to the implicit
noEvent
in the warning case? Does it have to be dynamically switched off and on as the level changes? #2571 seems relevant as well.The text was updated successfully, but these errors were encountered: