[Top] [All Lists]

Re: 'header' test and whitespace

2005-11-29 19:06:31

On Tue, Nov 29, 2005 at 03:25:43PM -0800, Philip Guenther wrote:
"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

Oh.. I misunderstood the remarks then (and then assUmeD too much about
the code snippet not working).  I nearly added some words about how I
wasn't absolutely sure from the textual description what the test was
looking for (in the presence of of the "degenerate" example), but I
didn't since it seemed clear enough to me -- but in the opposite of the
intended meaning, apparently.  In my sight, yes, there is a given header
field there that is empty, and thus the test should return true (to
match the narrative).  I don't really see "the Cc: header" -- I see two
"Cc: header fields" and I would indeed view one of their bodies as
empty.  It's hard to account for the way different people look at
things, especially when English is involved.

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" "?*"

I would still come up with the same (opposite of what was intended)
interpretation of the new phrasing, although I'd probably be less sure
of it :).  There's still the ambiguity between "all" and "any" (or
"some" and "none", etc) that can lead to different interpretations.  And
I think replacing "empty" with a more complex phrase obscures the
meaning-- "empty" or "blank" should be pretty clear in the narrative.  I
would find this a little clearer:

    Testing whether there is no appearance of a non-empty field body for
    a given header name can be done using a negated header test:

although still clunky.

But I think you could say

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

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

Hah.  Yes, indeed.


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