[Top] [All Lists]

Re: [sieve] I-D Action: draft-ietf-sieve-convert-02.txt

2011-08-23 12:38:52
Barry Leiba wrote:

Now, this doesn't take into account Alexey's comment that he'd like to
see a runtime error when conversion fails, so I want to push on this:
What is the use case?  Is it more valuable to the use case for a
failed conversion to crash the script, or for it to just continue?
The sense I have is that it should continue (which is why I wrote the
text above).
"I've asked you and you ignored me" behavior doesn't seem right in Sieve. I
don't think any other extension does that.
I don't think this is a good reason to have it work this way, unless
we have a use case that merits the extra complexity.

Can you clarify what kind of complexity you are talking about?

But it might not
matter, if we can agree on my other suggestion, so let's discuss that
I tend to agree.

Finally, I had an idea for how we could do the testing, which might
satisfy both issues:
Why not have the "convert" action *also* be a test.  Like this:

*** convert with no test ***
    require ["mime", "fileinto", "convert"];
    if header :mime :anychild :contenttype
              "Content-Type" "image/tiff"
      convert "image/tiff" "image/jpeg" "pix-x" "320" "pix-y" "240";
      fileinto "";

*** convert with test ***
    require ["mime", "fileinto", "convert"];
    if header :mime :anychild :contenttype
              "Content-Type" "image/tiff"
      if convert "image/tiff" "image/jpeg" "pix-x" "320" "pix-y" "240"
        fileinto "";

So it could work either way.  In the case where it's used in a test,
it would evaluate TRUE if it ran with no errors -- that is, the
conversion is supported, the parameters are correct, and no
conversions failed
If it's used only as an action, with no test, then any failure generates
a runtime error.

What do people think about that?  This would be the first action that
could also be used as a test, so think about whether that's good for
the language.  I like it, and I think it makes things very simple.
I don't mind that. But I don't think that that should imply any general
correlation between actions and tests for all future extensions we might
I don't understand that comment; can you explain it?

Do you mean that making this both an action and a test shouldn't imply
that any other actions can be used as tests also?

Yes. Or rather the other way around: not every test is expected to be used as an action. I was thinking about calling functions in C: they can be used in tests and they can also be called so that their return value is ignored.

I certainly agree:
of course it shouldn't.  Future extensions will define their behaviour
as they like, and might or might not use this model.  This model makes
sense here, I think.  It won't make sense in general, and this
wouldn't be a general change in the behaviour of Sieve actions.
Good. Tests and actions are effectively in different namespaces.

sieve mailing list