-
Notifications
You must be signed in to change notification settings - Fork 270
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
With introduction of null, it's better to allow short circuiting (lazy evaluation) for those boolean operators #427
Comments
I think this can be easily implemented in the expression evaluator here case INFIX_OPERATOR:
result =
token
.getOperatorDefinition()
.evaluate(
this,
token,
evaluateSubtree(startNode.getParameters().get(0)),
evaluateSubtree(startNode.getParameters().get(1)));
break; The operator type has to be checked. If it is a logical AND, then evaluate the first operand only. |
Similar logic can be implemented for the logical OR operator. If the first operand is TRUE, skip evaluating the second operand. |
OK. I see. I think given that user can define custom operators, we can define an additional I can also help to make the change if this sounds reasonable. |
This is exactly what I had in mind. If there is no breaking changes, it could go to a 3.2.0 version. |
I see the library now support null but perhaps it's better to also allow short circuiting for those boolean operator? Consider an example:
If
v
is set tonull
, we will get an exception sayingnull
cannot be compared.It seems that operators don't have the option to be lazy? So perhaps the workaround here is to introduce an
AND
function:The text was updated successfully, but these errors were encountered: