Fix: force the evaluation of all boolean expression clauses #282
Labels
🔚 backends
Backend runtime or code generation
❌ bug
Something isn't working
🔧 compiler
Issue concerns the compiler
👌 good first issue
Good for newcomers
While refactoring the log event structure in #280, I found that generated raw log events by compiled catala programs differ from the interpreter log trace.
It appears that it comes from the laziness of the
and
andor
operators in OCaml, resulting that when evaluating the expressionx and f y
ifx == false
then the whole expression is evaluated tofalse
without callingf
withy
.Example on
tests_allocations_familiales.catala_fr
with the scopeTest1
Example of raw events retrieved from the OCaml program:
The corresponding log events from the interpreter -- the call to
PrestationsFamiliales.conditions_hors_âge
is missing in the OCaml program log trace.Solutions
In order to keep the same behavior between all targeted languages, we should force the evaluation of all clauses. To do this there are two main ways:
and
andor
operators.The text was updated successfully, but these errors were encountered: