-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Every Keyword #2090
Comments
This was referenced May 26, 2020
Would we want to allow further constraints? The following every x { input.containers[x]; input.containers[x].label } could limit the domain of |
For tracking purposes: the remaining bits are
|
This was referenced Feb 11, 2022
Merged
This will ship with the next release. 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Rego, by default, variables are "existentially quantified". This means that when you want to express assertions over every member of a collection you need to either use double-negation or comprehensions and aggregates. This often trips up new users and in some cases leads to bugs where the author thinks they's expressed "for all elements in x ..." but have not.
To address this issue we could introduce a new keyword that declares universally quantified variables along with their domain. For example:
Note, it's important that users declare the domain because otherwise it's ambiguous. For example:
Similarly, while it's appealing to omit the domain, even simple cases could be confusing. For example:
What is the domain of
x
here? It could be interpreted as all containers in input, all containers in input with an image field (some may not include an image field), or all containers in the input with an image field that start with...The text was updated successfully, but these errors were encountered: