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

Re: NULL vs. ""

2005-05-30 09:28:59


> I'm not sure what a NULL string means in the context of Sieve, 822, or at
> all, actually.

I suppose we are saying it's the value of an absent header, not just an
empty header.

The discussion reminds me of when I was trying to write gui to say "when
header X is empty" and then was surprised how many iterations of script I
went through until I got exactly what I wanted.  These were both wrong in
terms of the concept I was trying to communicate to users:

if header :is "Cc" ""  // ie if there is a header that is blank
if not exists "Cc"        // ie if the header does not exist

I eventually ended up with:

if not header :regex "Cc" "."    // If there is no Cc header that contains
any character

Which felt pretty clumsy for what seems to be a pretty obvious use for
Sieve.  It also requires regex, which isn't necesarily available.

Regex isn't necessary here. While I fail to see a use case for this particular
test, the first way to code this as a single test that came to mind was:

 if not header :matches "Cc" "*?*

Seems very straightforward to me.

Thealternative being:

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

This is actually clearer to read IMO, and is probably how I would code it if
I ever wanted such a test.

But a NULL string concept doesn't really help much here either, as it
basically offers the same as what we have with the exists test, but it just
allows you do use variables instead of the exists test directly.  Perhaps
most of the time you would actually want to treat absent headers the same as
empty headers in terms of processing, and if you really wanted to make the
distinction then you could just use exists?

What might be nice is if we could say:

if header :is "Cc" NULL  // ie if the header is absent or empty

The semantics of this are not at all obvious from inspection. Given that it is
both unnecessary and IMO much less readable, I see no justificatio for adding
it and lots of justification for keeping it out.

                                Ned


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