wip: short-circuiting boolean operators #188
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Even though the semantics of the stack machine are eager, what we actually care about is && and || being non-strict (rather than lazy). The difference being non-strict and lazy is not observable from the outside since datalog cannot perform side-effects.
This PR is only intended as a proof of concept, since this update is a breaking change. It would have to be bundled in a token block version upgrade.
A note: unbound variables still abort evaluation. This can be debated. My point of view is that variable bindings are static as far as the expression itself is concerned, while actual evaluation failures usually depend on the actual values bound to variables.
I'm not sure why the samples test pass though, running them locally gives a different output for sample 27, where strict evaluation of booleans is tested.