You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, functions were implemented with a separate set of types that
had their own code paths in the compiler, eval, etc. These changes
refactor the function implementation so that functions are implemented
as rules with one or more arguments.
By representing functions as rules, we can avoid special casing required
to support functions, e.g., during parse and compile there are a number
of steps that required special casing for functions:
- Parser needed separate grammar definitions for functions (which
prevented them from being chained or using else)
- Compiler needed separate resolver and type checker implementations
which was a source of bugs.
In some cases, special casing is unavoidable for now (e.g., during eval)
however this could be improved in the future.
Fixesopen-policy-agent#471Fixesopen-policy-agent#467Fixesopen-policy-agent#463
in this use case:
x {
"a": 1,
"b": 2
}
w = x.a {true}
w returns 1
r(obj) = x.a {true}
fails with:
1 error occurred: 1:1: rego_unsafe_var_error: var data is unsafe
the following form works:
r(obj) = num {true; num = x.a}
The text was updated successfully, but these errors were encountered: