biscuit icon indicating copy to clipboard operation
biscuit copied to clipboard

`.type()` function

Open divarvel opened this issue 2 years ago • 0 comments

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.

divarvel avatar Apr 25 '23 14:04 divarvel