On 08/04/2011 12:39, Geoffrey De Smet wrote:
> Related to the modify expression,
> I 've always wondered about this code:
>
> rule "MyRule"
> when
> $p : Person(name = "Yoda")
> then
> modify ($p) {
> setAge(300)
> }
> end
>
> Doesn't this create an infinite loop? (In my experience
it does or at
> least it takes a lot longer)
> Because the modify ($p) schedules any rule using a
Person back on the
> agenda to be re-evaluated,
> so also that rule, which is evaluated and executed
again, modifying $p
> again, ... hence the infinite loop?
It would, unless you have slot specific - which Jess does.
Slot specific
is something I really want to add, I think it will resolve a
lot of
recursion problems and make Drools a lot easier to use. I took
the slot
specific problem and genericsed it further for "slot
listeners". I
discussed this here:
http://blog.athico.com/2010/07/slot-specific-and-refraction.html.
I
think Laune added some refinements to this in a mailing list
entry
somewhere.
Mark