[rules-dev] feature request: undo-then

Geoffrey De Smet ge0ffrey.spam at gmail.com
Wed Feb 18 14:57:22 EST 2009


How hard would it be to allow something like this in the DRL?

rule "myRule"
   when
     t: Total()
     ... // a bunch of complicated fact constraints
   then
     t.increment();
   undo-then
     t.decrement();
end

The current workarounds don't are clunky:
- Writing an negative (opposite) rule isn't efficient: it means 
declaring the rule twice effectively. Also the negative rule is usually 
using lots of or's and not's which isn't fast.
- Using logical inserts is a more heavy weight (= slower).



Here's another description of this feature request from the user mailing 
list:

> Ah, well that's my point of ignorance, then.  I was thinking in stateless mode.  :)   And to do what I suggest in a stateful manner would require a "modifyLogical" type functionality in place of the insertLogical.  i.e.
> 
> modifyLogical (object) {
>   //do this when the condition obtains
> } else {
>   //do this when the condition no longer obtains
> }
> 
> Could be an interesting functionality to have, though. 


-- 
With kind regards,
Geoffrey De Smet




More information about the rules-dev mailing list