[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative definitions for 5.1 (allof) and 5.2 (anyof)



"Alan K. Stebbens" wrote:

> I would like to propose alternative definitions for the "allof" (Sec 5.1)
> and "anyof" (5.2) tests.  The essential difference is to allow the words
> "and" and "or" as binary, infix operators for equivalent semantics.
>
> 5.1. Test allof / and
>
>    Syntax:   allof ( <test> , <test> , ... <test> )
>          or:   <test1> and <test2>
>
>    The allof test preforms a logical AND on the tests supplied to it.  The
> tests
>    evaluated from left to right, and evaluations of the tests stops on the
> first
>    test with a "false" result. The allof test takes as its argument a
> test-list.
>
>    The "and" operator returns the logical AND of both tests.  <Test1> is
>    evaluated first, and only if its result is true then <test2> is
> evaluated.
>    Multiple occurances of "and" within the same test expression is evaluated
>    from left to right.  I.e.:
>
>         <test1> and <test2> and <test3>
>
>    is equivalent to
>
>         (<test1> and <test2>) and <test3>
>
>    Examples:  allof (false, false)  =>   false
>               allof (false, true)   =>   false
>               allof (true, true)    =>   true
>
>                   exists header ["To"] and exists header ["Cc"]
>
> Similarly, the "anyof" definition should be:
>
> 5.2. Test anyof / or
>
>    Syntax:   anyof ( <test> , <test> , ... <test> )
>        or:   <test1> or <test2>
>
>    The anyof test preforms a logical OR on the tests supplied to it.  Tests
>    are evaluated from left to right, stopping at the first test that results
>    in a "true" result.
>
>    The "or" operator returns the logical OR of both tests.  <Test1> is
> evaluated
>    first, and only if its value is "false", then <test2> is evaluated.
> Multiple
>    occurances of "or" within the same test expression are evaluated from
> left to
>    right. I.e.:
>
>         <test1> or <test2> or <test3>
>
>    is equivalent to:
>
>         (<test1> or <test2>) or <test3>
>
>    Examples:  anyof (false, false)  =>   false
>               anyof (false, true)   =>   true
>               anyof (true, true)    =>   true
>
>                   exists header ["To"] or exists header ["Cc"]
> --
> Alan K. Stebbens <alan.stebbens@xxxxxxxxxxxx>

As I understand you want to solve problem with short-circuit evaluation by
adding "and" an "or".
I have no objections, but this will complicate parsing.

--
Regards,
Alexey Melnikov
------------------------------------------
SMTP/POP3/IMAP4/ACAP servers creation team

Epsylon Technologies, Russia
 http://www.taxxi.com

Imap Development Kit (my own product)
http://194.87.43.111/homerus/mail/idk/index.htm

Fax (in San Diego, California): 1 (619) 8393837
------------------------------------------