[Top] [All Lists]

regarding short-circuiting

2004-08-12 11:14:34

while perusing the list archive, I found another point which probably
needs addressing in the draft.  consider:

        if address :matches ["To", "Cc"] ["kjetilho(_at_)*", 

if a message contains both "To: kjetilho(_at_)darwin(_dot_)uio(_dot_)no" and 
k(_dot_)t(_dot_)homme(_at_)hedda(_dot_)uio(_dot_)no" -- what's the value of 
${1} ?

the current draft says:

        The interpreter MUST short-circuit tests, ie. not perform more
        tests than necessary to find the result.

so the behaviour is undefined.

one suggestion was to specify ordering explicitly:  for each pattern,
iterate over each header in the list.  (according to this algorithm,
${1} holds "".)

the other view is that users which need determinism can write

        if anyof(address :matches ["To", "Cc"] "kjetilho(_at_)*",
                 address :matches ["To", "Cc"] "k(_dot_)t(_dot_)homme(_at_)*")

in either case, I think the draft should make clear whether the result
is undefined or not.

on a slightly related note, the draft rules out cute tricks such as

        if allof(address :matches ["To", "Cc"] "kjetilho(_at_)*",
                 address :is ["To", "Cc"] "abuse(_at_)${1}")

based on this wording:

        The expanded string MUST use the variable values which are
        current when control reaches the statement the string is part

in other words, ${1} expands to the value it had before the first
address test.

(the user can get the desired behaviour by nesting if-tests.)
Kjetil T.

<Prev in Thread] Current Thread [Next in Thread>