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 xsin 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.
Currently, the
in
operator is implemented via theinternal.member_2
andinternal.member_3
built-in functions. That way, the evaluator has the evaluate the operands ofx, 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.☝️ 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.