[Top] [All Lists]

Re: 'header' test and whitespace

2005-11-29 16:41:42

"Mark E. Mallett" <mem(_at_)mv(_dot_)mv(_dot_)com> writes:
On Tue, Nov 29, 2005 at 12:28:57PM +0100, Kjetil Torgrim Homme wrote:
also in the latest draft is this:

   The preferred way to test whether a given header is either empty or
   absent is to combine an "exists" test and a "header" test:

           anyof (header :is "Cc" "", not exists "Cc")

this will evaluate to true for:

  Cc: someone(_at_)example(_dot_)org

it may not be worth considering this rather degenerate case.  it seems
to me Bcc is a more likely candidate for the stated test.  however, one
way of stating the test correctly is:

  not (header :matches "Cc" "?*")

it's not much more convoluted, so I think it is worthwhile to change the
"preferred way".

Parentheses aside... in my implementation at least, the "header" test
would return true (because of the non-empty 'cc'), and be notted to
return false.  So this wouldn't work.

His point is that _is_ the desired behavior.  Given the two line message
header above, you would say that the Cc: header is either missing or
empty?  It certainly isn't missing and while one occurrence is empty, I
would not call "the Cc: header" empty, so returning 'false' is the Right

Anyway, I've replaced the text in the I-D with this:
    Testing whether a given header is either absent or doesn't contain
    any non-whitespace characters can be done using a negated "header"
        not header :matches "Cc" "?*"

But I think you could say

  not allof (exists "cc", header :matches "cc" "?*")

That's equivalent to what's in the -05 I-D.

Philip Guenther

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