[Top] [All Lists]

Re: [Fwd: I-D ACTION:draft-freed-sieve-environment-ihave-00.txt]

2006-11-27 15:20:59

On Thu, Nov 16, 2006 at 08:38:33AM -0800, Aaron Stone wrote:

Let's say we dropped Ned's suggested requirement that actions must be
used inside of ihave blocks testing for them.

That would be my quibble with 'ihave' as well.  While it might be
interesting to have a capability enabled for a block scope, I don't
think that doing this via a side-effect of a test inside of 'if' would
be the way to go about it.  It creates too much of a magical connection
between the evaluation of the test inside of the 'if' and the code block
that follows the 'if', and I think that would cause confusion to script
writers and Sieve language implementers, both.  It also asks for too
much context to be known inside the 'if' expression evaluator, e.g.:

   if not ihave "vacation" { ... }
   elsif something-else { ... # is vacation enabled here? }
   else { ... # how about here? }

the "ihave" has to know a lot about what's around it, like if there's a
'not' out there that, at least in my implementation, would actually be
applied after the 'ihave' test was already disposed of.  That's only a
very simple perversion, I can imagine others more complex :)  While I
could implement it, I wouldn't like to...

If one wants block scope of capabilities, I would think there are other
ways to accomplish it.  One way would be to have a new control command
with an attached block that could be else'd, e.g.:

    enable "vacation" { ... }
    else { ... }

Or simply separate the test and the enable, e.g.:

    if ihave ["vacation", "notify" ] {
        enable ["vacation", "notify"];

If desired, this could be defined so that the effect of the enable went
away when its containing block ended.  I dunno if I would want that, I
guess I'd have to think about it; I tend to prefer more explicit
twiddling (e.g. by also having a complementary "unenable").  Then again,
I don't really see why one would want the capability to go away once

Also I wonder about this bit:

   > Ihave is designed to be used with extensions that add tests, actions,
   > or comparators.  It MUST NOT be used with extensions that change how
   > the content of Sieve scripts are interpreted such as the variables
   > extension [I-D.ietf-sieve-variables]