Skip to content
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

wip: short-circuiting boolean operators #188

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

divarvel
Copy link
Collaborator

@divarvel divarvel commented Oct 11, 2023

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.

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.
@divarvel
Copy link
Collaborator Author

I think i have found a way to have closures in the stack machine. Laziness is trivially implemented through closures, so this PR might be closed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants