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

.type() function #134

Open
divarvel opened this issue Apr 25, 2023 · 0 comments
Open

.type() function #134

divarvel opened this issue Apr 25, 2023 · 0 comments
Milestone

Comments

@divarvel
Copy link
Collaborator

Ill-typed operations currently make evaluation fail. This makes it easy to have datalog evaluation errors, since introducing a new fact with terms of an unexpected types can make a rule blow up somewhere else.

If we go ahead with lazy || and &&, introducing a typeof operator would allow guarding operations with a type check, providing a way to avoid evaluation failure in the face of terms of unexpected types.

For instance:

`check if resource($resource), $resource.type() == "string" && resource.starts_with("file_")`

using a .type() method call would integrate cleanly with the existing parser, that's why i used it instead of a typeof operator syntax, but that can be debated later.

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

No branches or pull requests

1 participant