open-policy-agent / opa

Open Policy Agent (OPA) is an open source, general-purpose policy engine.
https://www.openpolicyagent.org
Apache License 2.0
9.36k stars 1.3k forks source link

topdown/EE: EE with `in` operator #4037

Open srenatus opened 2 years ago

srenatus commented 2 years ago

Currently, the in operator is implemented via the internal.member_2 and internal.member_3 built-in functions. That way, the evaluator has the evaluate the operands of x, y in xs in full, and invokes the function with them.

While the internal.member_{2,3} functions stop after the first match, evaluating the operands fully still can be some work that could be avoided.

p {
  "foo" in q
}

q["foo"] {
  print("foo")
}
q["bar"] {
  print("bar")
}

☝️ This should only print "foo".

This is semantically related to #4035, but the underlying structures and changes are different, because of the built-in function implementation.

srenatus commented 2 years ago

This is pretty much the same issue as #3948.... 💭

stale[bot] commented 2 years ago

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.