On Thu, Apr 21, 2005 at 07:05:40PM -0400, Matt Kettler wrote:
> >body __sub_meta_a  some-not-costly-eval
> >body __sub_meta_b  a-costly-eval
> >meta meta_rule  (__sub_meta_a && __sub_meta_b)
> >
> >under this example, which of the following happen?
> >
> >a)  __sub_meta_a AND __sub_meta_b are evaluated first, followed by
> >meta_rule being evaluated.

Yep.

> AFAIK all rules beginning with __ are always executed. There's no
> optimization of meta sub-parts. Even completely unreferenced sub-parts
> will be executed.

Yes, mostly.  Just for clarification:  Rules beginning with __ are simply
rules, so they execute like any other rules.  The only difference is
that by default they don't contribute to the message score.  You can do
"score __RULE 0" and disable it if you want to.

So based on this, assuming the __sub_meta* rules aren't disabled, the non-meta
rules run first, then the meta rules are run, so there's no short circuiting
of evals possible with the current code.

You could fake this, however, by manually manipulating things ala:

body __sub_meta_a  some-not-costly-eval
body __sub_meta_b  a-costly-eval
priority __sub_meta_a -1000
# __sub_meta_b stays at default priority of 0

Then in the eval (assuming code here, not just RE,) for __sub_meta_b,
check to see whether __sub_meta_a has triggered, since by specifying
the priority, you're guaranteed that it will run first.  If it didn't
trigger, return 0 immediately.  Otherwise, proceed with the code.


To answer the next possible question, BTW:

meta __meta_a __sub_meta_a && __sub_meta_b
meta __meta_b __sub_meta_c && __sub_meta_d
meta RULE __meta_a || __meta_b

The SA code determines that RULE has 2 other meta rule dependencies and will
schedule that to run after the __meta_* rules which have 0 other meta rule
dependencies. :)

-- 
Randomly Generated Tagline:
Always remember that you're representing our country.  I guess what I'm
 saying is, don't mess up France the way you messed up your room.
 
                -- Homer Simpson
                   The Crepes of Wrath

Attachment: pgpImWgeNRKIW.pgp
Description: PGP signature

Reply via email to