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

Deprecate and remove any() and all() functions #2437

Closed
tsandall opened this issue May 27, 2020 · 3 comments · Fixed by #4271
Closed

Deprecate and remove any() and all() functions #2437

tsandall opened this issue May 27, 2020 · 3 comments · Fixed by #4271

Comments

@tsandall
Copy link
Member

We should deprecate and eventually remove the any() and all() built-in functions. Neither of these functions implement behaviour that's otherwise hard to implement in Rego yet their implementation makes some arbitrary assumptions that are problematic (e.g., non-true/false values are not considered "true-ish" like most other Rego constructs asusme, both are satisfied by empty collections, etc.)

The any function is particularly bad since there is almost no difference between saying any({x | ...}) and simply .... Similarly, once we have the every keyword (#2090) the need for all will be substantially reduced.

@gaga5lala
Copy link
Contributor

Hi @tsandall, does this means to remove built-in ast functions defined in ast/builtins.go and relative files (are they mostly defined in #828?). And then run go test locally (or submit PR wait test result on CI) to check is there any missing pieces?

@patrick-east
Copy link
Contributor

@gaga5lala That is correct, however I'm not sure how soon we would want to make the change. These backwards compatibility changes will need to be handled carefully.

@srenatus
Copy link
Contributor

💭 While we're at it, should we drop and and or as non-infix variants of set intersection & and union |? Those must seem confusing to newcomers.

anderseknert added a commit to anderseknert/opa that referenced this issue Mar 9, 2021
Since there are better ways of doing what they do and they tend to confuse
people new to Rego we'll hide these from the policy reference for now. Will
eventually be deprecated and removed with issue open-policy-agent#2437.

Signed-off-by: Anders Eknert <[email protected]>
tsandall pushed a commit that referenced this issue Mar 9, 2021
Since there are better ways of doing what they do and they tend to confuse
people new to Rego we'll hide these from the policy reference for now. Will
eventually be deprecated and removed with issue #2437.

Signed-off-by: Anders Eknert <[email protected]>
This was referenced Mar 12, 2021
johanfylling added a commit to johanfylling/opa that referenced this issue Jan 28, 2022
Updating compiler strict mode to produce error when these deprecated methods are used.

Fixes: open-policy-agent#2437
Signed-off-by: Johan Fylling <[email protected]>
srenatus pushed a commit that referenced this issue Jan 31, 2022
Updating compiler strict mode to produce error when these deprecated methods are used.

This introduces a new stage to ast.Compiler and ast.QueryCompiler.

Fixes: #2437

Signed-off-by: Johan Fylling <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants