I agree with both your and Wolfgangs comments; however it does sound remarkably like Mark&#39;s &quot;Slot Specific&quot; vision.<br><br>Perhaps the same issues apply and hence will no doubt be something for Mark and Edson to sleep on :)<br>
<br><div class="gmail_quote">On 8 April 2011 13:57, Geoffrey De Smet <span dir="ltr">&lt;<a href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">&gt; Wouldn&#39;t it be great(?) and an optimisation that with &quot;true modify&quot;<br>
&gt; (i.e. no longer a remove and insert) that we could only re-evaluate<br>
&gt; rules that contained a pattern on a constraint affected by the update?<br>
<br>
</div>I doubt if that is possible, consider this case with a calculated getter:<br>
<br>
class Person {<br>
    private int age;<br>
<br>
    public int getAgeInHours() {<br>
       return 24 * age;<br>
    }<br>
<br>
    // getter and setter for int age<br>
<br>
}<br>
<br>
and these rules:<br>
<br>
rule &quot;MyRule1&quot;<br>
<div class="im">   when<br>
     $p : Person(name = &quot;Yoda&quot;)<br>
   then<br>
     modify ($p) {<br>
       setAge(300);<br>
     }<br>
end<br>
</div>rule &quot;MyRule2&quot;<br>
   when<br>
     $p : Person(ageInHours &gt; 2400)<br>
   then<br>
     System.out.println(&quot;This guy is older than 2400 hours!&quot;);<br>
end<br>
<br>
After MyRule1 fires and Yoda&#39;s age becomes 300, MyRule2 should fire<br>
because Yoda&#39;s older than 2400 hours.<br>
<br>
Next, add eval()&#39;s in the mix for more cases like this.<br>
<br>
Op 08-04-11 14:11, Michael Anstis schreef:<br>
<div class="im">&gt; Wouldn&#39;t it be great(?) and an optimisation that with &quot;true modify&quot;<br>
&gt; (i.e. no longer a remove and insert) that we could only re-evaluate<br>
&gt; rules that contained a pattern on a constraint affected by the update?<br>
&gt;<br>
&gt; So,<br>
&gt;<br>
&gt; rule &quot;MyRule&quot;<br>
&gt;   when<br>
&gt;     $p : Person(name = &quot;Yoda&quot;)<br>
&gt;   then<br>
&gt;     modify ($p) {<br>
&gt;       setAge(300);<br>
&gt;     }<br>
&gt; end<br>
&gt;<br>
&gt; would not cause &quot;MyRule&quot; to re-evaluate as there&#39;s enough information<br>
&gt; present to ascertain that the modify does not alter the match.<br>
&gt;<br>
&gt; Tell me Wolfgang, why this is such a bad idea - I just know you&#39;ll<br>
&gt; have a good explanation :)<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; Mike<br>
&gt;<br>
&gt; On 8 April 2011 13:00, Esteban Aliverti &lt;<a href="mailto:esteban.aliverti@gmail.com">esteban.aliverti@gmail.com</a><br>
</div><div class="im">&gt; &lt;mailto:<a href="mailto:esteban.aliverti@gmail.com">esteban.aliverti@gmail.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Yes, It creates the exact same infinite loop that this code does:<br>
&gt;<br>
&gt;     rule &quot;MyRule&quot;<br>
&gt;       when<br>
&gt;         $p : Person(name = &quot;Yoda&quot;)<br>
&gt;       then<br>
&gt;         $p.setAge(300);<br>
&gt;         update($p);<br>
&gt;     end<br>
&gt;<br>
&gt;     As far as I know, the results are the same. The modify() is a more<br>
&gt;     compact way to do a lot of set() invocations and an update().<br>
&gt;     Maybe there are also some other advantages of using modify(),<br>
&gt;     like optimization for example.<br>
&gt;<br>
&gt;     Best Regards,<br>
&gt;<br>
&gt;     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
&gt;<br>
&gt;     Esteban Aliverti<br>
</div>&gt;     - Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a> &lt;<a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a>&gt;<br>
<div class="im">&gt;     - Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     On Fri, Apr 8, 2011 at 8:39 AM, Geoffrey De Smet<br>
</div><div class="im">&gt;     &lt;<a href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a> &lt;mailto:<a href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;         Related to the modify expression,<br>
&gt;         I &#39;ve always wondered about this code:<br>
&gt;<br>
&gt;         rule &quot;MyRule&quot;<br>
&gt;           when<br>
&gt;             $p : Person(name = &quot;Yoda&quot;)<br>
&gt;           then<br>
&gt;             modify ($p) {<br>
&gt;               setAge(300)<br>
&gt;             }<br>
&gt;         end<br>
&gt;<br>
&gt;         Doesn&#39;t this create an infinite loop? (In my experience it<br>
&gt;         does or at<br>
&gt;         least it takes a lot longer)<br>
&gt;         Because the modify ($p) schedules any rule using a Person back<br>
&gt;         on the<br>
&gt;         agenda to be re-evaluated,<br>
&gt;         so also that rule, which is evaluated and executed again,<br>
&gt;         modifying $p<br>
&gt;         again, ... hence the infinite loop?<br>
&gt;<br>
&gt;         --<br>
&gt;         With kind regards,<br>
&gt;         Geoffrey De Smet<br>
&gt;<br>
&gt;<br>
&gt;         _______________________________________________<br>
&gt;         rules-dev mailing list<br>
</div>&gt;         <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>&gt;<br>
<div class="im">&gt;         <a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     _______________________________________________<br>
&gt;     rules-dev mailing list<br>
</div>&gt;     <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>&gt;<br>
<div class="im">&gt;     <a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-dev mailing list<br>
&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br>
</div>--<br>
<div><div></div><div class="h5">With kind regards,<br>
Geoffrey De Smet<br>
<br>
<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
</div></div></blockquote></div><br>