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
false ? true.exists_one(i, false) : false raises *BoolType* object is not iterable.
Expected: The first false should skip the first branch of the condition and execute the "else" branch (the last false).
To get traditional left-to-right short-circuiting evaluation of logical operators, as in C or other languages (also called "McCarthy Evaluation"), the expression e1 && e2 can be rewritten e1 ? e2 : false. Similarly, e1 || e2 can be rewritten e1 ? true : e2.
This error doesn't happen for false ? 1/0 : true. This condition correctly skips the division by zero.
The text was updated successfully, but these errors were encountered:
sewi-cpan
added a commit
to sewi-cpan/cel-python
that referenced
this issue
Dec 6, 2023
[The CEL language definition](https://github.com/google/cel-spec/blob/master/doc/langdef.md#logical-operators) suggests:
> To get traditional left-to-right short-circuiting evaluation of logical operators, as in C or other languages (also called "McCarthy Evaluation"), the expression e1 && e2 can be rewritten `e1 ? e2 : false`. Similarly, `e1 || e2` can be rewritten `e1 ? true : e2`.
`cel-python` used to evaluate the full tree before deciding if a branch will be used or not. This PR only evaluates a branch if selected by the condition.
Fixes issue cloud-custodian#50
false ? true.exists_one(i, false) : false
raises*BoolType* object is not iterable
.Expected: The first
false
should skip the first branch of the condition and execute the "else" branch (the lastfalse
).The CEL language definition says:
This error doesn't happen for
false ? 1/0 : true
. This condition correctly skips the division by zero.The text was updated successfully, but these errors were encountered: