procmail
[Top] [All Lists]

Re: Defining a common set of actions ?

1997-05-22 16:44:00
"Alan K. Stebbens" <aks(_at_)anywhere(_dot_)engr(_dot_)sgi(_dot_)com> writes:
...
I've always wondered why some folks seem to prefer using the negated
tests in front of a null block, followed by an "else" block, rather than
what seems to be more obvious form of weighted scores:

Habit: once you have a solution that a) works, and b) you understand,
there's no reason to change to anything that isn't totally superior.  I
find the negated form to be less cluttered, so I see little reason to
change, though I do _try_ to remember to mention both when people ask,
so that they can make their own choice.


   :0
   * 2^0 some test
   * 2^0 some other test
   * -1^0
   {
      # if any test succeeds
   }

There's no need for the -1^0, as a recipe with weighted conditions only
matches if the total score is positive, i.e., >0, and of course, you
can short circut the condition testing by using 'infinite' weights.


The exception, of course, is if "some test" or "some other test" are
already using weighted scores.

...in which case they're already being OR'ed in a sense.  Hmm, weighted
conditions are like tunnel diode logic, where the same circut does AND
or OR, depending on how the inputs are weighted relative to a bias and
the breakover voltage.  (That's too obscure a reference, isn't it?)


Philip Guenther

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