Open anderseknert opened 1 month ago
When read as natural-language English, not every x in y
could be interpreted as some x in y
, which excludes no x in y
.
Not an argument against this change, just something we might want to clarify in the docs.
When read as natural-language English, not every x in y could be interpreted as some x in y, which excludes no x in y.
What do you mean with "excludes no x in y"? 🤔
"Not every fruit in the basket is yellow" (not every x in y { p(x) }) ⬇️ "There is a fruit in the basked that is not yellow" (some x in y; not p(x))
Although not logically correct, when you say that not every item in a group has a property, the listener might incorrectly infer the subtext that at least a non-zero amount does: "Not every fruit in the basket is yellow" == "Not every fruit in the basket is yellow, but some are". Just a quirk in how a listener/reader might fill in the blanks, even when there are none to fill. Might even be something not even worthwhile noting in the docs, as people are probably in a more precise state of mind when reading code.
"All animals are equal, but some animals are more equal than others"
:)
two feet bad
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue.
I know there are reasons why we currently don't, and that there are other ways to achieve the same outcome, but for someone not deeply familiar with Rego, it might not be obvious how to get there. Additionally, and certainly not to be dismissed,
not every
reads rather nicely compared to many of the alternatives.As a "good enough" solution if we intend to keep the current behavior, we can improve the error message, and rather than to say:
We point the user to documentation where we explain why it can't be expressed that way, and what they should use instead.
A side note really, but a pretty nice side-effect of allowing this is how
every
provides a body of its own, and can be used even with "single-line" rules, which would allow the example above to be written as: