[PEAK] Issues with peak.rules predicates

rdmurray at bitdance.com rdmurray at bitdance.com
Sat Feb 9 17:32:35 EST 2008

I wrote a rather complicated set of code using RuleDispatch.  It was
working petty well, but I ran into a bug where the first time my test
suite ran everything worked, but the second time I got various tracebacks.
Deleting the .pyc file of the primary program module would allow the
tests to run successfully again.

Since RuleDispatch was deprecated I decided to shelve the project until
peak.rules acquired the RuleDispatch functionality I needed.  I think
it has at this point, so I've finally gotten around to picking this
project up again.

I've started by switching my code to using the peak.rules RuleDipatch
compatibility hooks (I don't use anything not covered by that API).
My test suite does not pass, even on the first run.  I'd like to get
my test suite passing before I start changing over to the peak.rules
API, if I can.

The first place I am getting an error arises from this line:

@checksemantics.when("DO is None and IDO is None and not V.isVIT")

The problem is that this rule is not firing, when under RuleDispatch
it does.  My guess is that the problem is V.isVIT.  The value of V.isVIT
is produced by a __getattr__.  I'm guessing that V.isVIT is
evaluating to True when it should be False.  Is this a limitation
of peak.rules?

As long as I'm writing, I'm also wondering if there is a simple way to
see what the dispatch mechanism is doing, of seeing what it is evaluating
the various values to be.  While developing with RuleDispatch I often
wished I had a way to get a trace of the dispatch machinery in action,
but I was always able to get my code working so I never got around to
asking about it :)


More information about the PEAK mailing list