Are implementations permitted to stop evaluating a test,
Yes. Not only are they permitted to do so, the variables extensions makes
short-circuiting a requirement - see RFC 5229 section 3.2.
when the result
makes no sense, e.g. in anyof(true, header "A" "B") evaluate "header"?
I think you meant "don't evaluate".
The point is, that Sieve-Variables, says (Sec. 3.2. Match Variables)
The decimal value of the match variable name will index the list of
matching strings from the most recently evaluated successful match of
type ":matches".
However it is not very clear for me if every test needs to be evaluated,
Which is exactly why the specification requires short-circuiting.
and thus if the last :match test was permitted to be evaluated, is it
necessary to evaluate it? Consider a message
A: Xa
B: Xb
C: Mc
and
if anyof (header :matches ["A", "B"] "X*",
header :matches "C" "M*") {
//what is ${1}?
}
What would be the value of ${1}
It's required to be "a".
* a - because after finding it out, the result of the first header test
is clear. Having true as the first parameter of anyof, then anyof stops
evaluation.
* c - because this is the last matched test and the evaluation has not
stopped after finding out that the first header test suffices for the
result of anyof
* b - header evaluates all possibilities, and anyof stops when the
result is clear.
Thanks in advance for your opinion,
This isn't a question of having an opinion, it's a question of what the
specification already requires.
Ned