I'm puzzled over the proper use of in-line evals.  I've used them successfully in some places. But it seems that on occasion something doesn't work when I think it should.
 
First, this is a when clause that works properly using a separate eval statement. The rule activates and fires when expected:
 
$rt : RuleTimer(uniqueName == "Hardware Status Request", timedOut == true)
$hw : Hardware($activelyMonitored : activelyMonitored, command == null)
      AttrBoolean(this == $activelyMonitored, currentValue == true)
      eval($hw.getStatusRequested().howOld() > $hw.getStatusPeriod())
 
 
However, this re-write changing to an in-line eval never fires.
 
$rt : RuleTimer(uniqueName == "Hardware Status Request", timedOut == true)
$hw : Hardware($activelyMonitored : activelyMonitored, command == null, eval(statusRequested.howOld() > statusPeriod) )
      AttrBoolean(this == $activelyMonitored, currentValue == true)
 
Likewise, this re-write doesn't fire either where I sought to bind the more complex statusRequested object to a Drools variable before using it in the eval. The field statusPeriod just holds a primitive double.
 
$rt : RuleTimer(uniqueName == "Hardware Status Request", timedOut == true)
$hw : Hardware($activelyMonitored : activelyMonitored, $sr : statusRequested, command == null,
               eval($sr.howOld() > statusPeriod) )
      AttrBoolean(this == $activelyMonitored, currentValue == true)
 
I haven't been able to find anything in the manual that says these other two syntaxes are wrong. Furthermore, the Drools compiler has no issues with them.
 
Thanks!
 
Allen F. Bagwell
e-mail:  afbagwe@sandia.gov
phone:  505/284-4517
fax:  505/ 844-7886
 
Ask your doctor if medical advice from a TV commercial is right for you.