[Top] [All Lists]

Re: NULL vs. ""

2005-05-30 06:32:01

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. The alternative being:

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

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


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