ietf-mta-filters
[Top] [All Lists]

Re: AD Evaluation Comments: draft-ietf-sieve-vacation-04

2005-10-21 03:53:56

On Fri, Oct 21, 2005 at 02:45:34AM +0200, Kjetil Torgrim Homme wrote:
On Fri, 2005-10-21 at 01:22 +0200, Michael Haardt wrote:
While thinking about it: The base spec does not define if anyof and
allof perform shortcut/lazy evaluation.  After all the years, all we can
probably do is saying that depends on the implementation.  It should be
mentioned, because it may cause the same script to behave different on
different implementations.

well, in 3028 tests cannot have side effects, so it isn't possible to
tell.  this restriction has been lifted to allow for the match variables
in variables, and that draft says:

   The interpreter MUST short-circuit tests, ie. not perform more tests
   than necessary to find the result.  Evaluation order MUST be left to
   right.  If a test has two or more list arguments, the implementation
   is free to choose which to iterate over first.

however, the future may bring other extensions which introduce tests
with side effects, so I guess it could be nice to have the above
clarification in the base spec, although conformance is not observable
with the base spec alone.

No, it is.  From section 2.6.10, Errors:

   Implementations MUST perform syntactic, semantic, and run-time checks
   on code that is actually executed.  Implementations MAY perform those
   checks or any part of them on code that is not reached during
   execution.

That means, "anyof" with one semantically valid test, that evaluates to
true, and one semantically invalid test, will evaluate to true, if using
shortcut evaluation and lazy checks, and generate an error with strict
evaluation or strict checks.

You mentioned another point: Evaluation order.  Indeed that is not
specified either, and it can be observed as well.

I would like to see short-cut evaluation and evaluation order from
left to right in the base spec, but I am not sure if we can do that.
It is an incompatible change.  Oops, I said the i-word.

Michael