You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!parser_rwh.compile(rightMostWhatHappens, expression)){
). This is unfortunate.
Why it is unfortunate
For example, something like n_R = 0.8 * n_R could mean "make the new pop. size of R 0.8 of what it was" but it could be an equality comparison (see, e.g., #31 (comment)). And we do allow to use ExprTk's full syntax in other places (fitness specifications, for example, where "=" and "==" are equalities, not assignments) so it is a very bad idea to now use = with such a different meaning.
Options
We should use := or maybe better <- as in R. ExprTk uses :=; using <- will make it more explicit that the assignment to the population on the left is not being done directly by ExprTk (though the expression on the right is processed by ExprTk). In some cases (single population) the assignement could be done by ExprTk, but not in others (when the expression involves the total population size and, thus, we sample from the multiv. hypergeom. to get the new population composition).
Steps
So change code, redo all examples and tests, create deprecation notice, etc.
N.B. And use the opportunity to fix some typos, like "imposible" 😅
The text was updated successfully, but these errors were encountered:
Problem
WhatHappens, in interventions, uses
=
(see all examples, and for the parsing see, e.g.,OncoSimul/OncoSimulR/src/UnityOncoSimul/intervention_private.cpp
Line 62 in b9b77ec
Why it is unfortunate
For example, something like
n_R = 0.8 * n_R
could mean "make the new pop. size of R 0.8 of what it was" but it could be an equality comparison (see, e.g., #31 (comment)). And we do allow to use ExprTk's full syntax in other places (fitness specifications, for example, where "=" and "==" are equalities, not assignments) so it is a very bad idea to now use=
with such a different meaning.Options
We should use
:=
or maybe better<-
as in R. ExprTk uses:=
; using<-
will make it more explicit that the assignment to the population on the left is not being done directly by ExprTk (though the expression on the right is processed by ExprTk). In some cases (single population) the assignement could be done by ExprTk, but not in others (when the expression involves the total population size and, thus, we sample from the multiv. hypergeom. to get the new population composition).Steps
So change code, redo all examples and tests, create deprecation notice, etc.
N.B. And use the opportunity to fix some typos, like "imposible" 😅
The text was updated successfully, but these errors were encountered: