I suppose that the proposed refraction (with onChange as control mechanism)<br>is based on "fine-grained" WM updates - the question is, how fine the grain is.<br>This is important for determining whether a rule will fire again, due to<br>
the LHS becoming false and then true again.<br><br>(These are contrived, but simple, examples.)<br><br>rule "insert-retract"<br>when<br> $a : Elem()<br> $b : Elem( this != $a )<br>then<br> retract( $a );<br>
// now LHS is false<br> insert( $a );<br> // now LHS true again<br>end<br><br>rule "increment-both-facts"<br>when<br> $a : Elem( $slot : slot )<br>
$b : Elem( slot == $slot, this != $a )<br>then<br> modify( $a ){<br> setSlot( $a.getSlot() + 1 )<br> }<br> // now LHS is false<br> modify( $b ){<br>
setSlot( $b.getSlot() + 1 )<br>
}<br> // now LHS is true again<br>end<br><br>rule "increment-both-slots"<br>
when<br>
$a : Elem( $slot1 : slot1, slot2 == slot1 )<br>
then<br>
modify( $a ){<br>
setSlot1( $a.getSlot1() + 1 ),<br> // now LHS is false<br> setSlot2( $a.getSlot2() + 1 )<br>
// now LHS is false<br> }<br>end<br>
<br>
I'm guessing that "insert-retract" and "increment-both-facts" will loop<br>even with the proposed change. I'm not quite so sure about the fate<br>of "increment-both-slots", but I'd bet my money on "loop" here, too.<br>
<br>But won't a "naive" interpretation of the refraction as proposed<br>lead to the assumption that none of these three rules will loop?<br><br>Anyway, a precise definition of when and how the true-false and<br>
false-true transitions may occur will be essential.<br><br>=*=<br><br>Another question arises in combination with "virtual" fields.<br><br>class Board { // a square board<br> int dim;<br> int getDim(){ return dim; }<br>
void setDim( int dim ){ this.tim = dim; }<br> int getFields(){ return dim*dim; }<br>}<br><br>rule "enlarge-board"<br>when<br> Limit( value )<br> $b : Board( onChange == [fields], fields < value )<br>
then<br> modify( $b ){<br> setDim( $b.getDim() + 1 )<br> }<br>end<br><br>I suppose this will not loop (until Limit.value is reached), but<br>I (being naive!) did say onChange == [fields]. <br><br>-W<br><br><div class="gmail_quote">
On 31 July 2010 20:53, Mark Proctor <span dir="ltr"><<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<a href="http://blog.athico.com/2010/07/slot-specific-and-refraction.html" target="_blank">http://blog.athico.com/2010/07/slot-specific-and-refraction.html</a><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>
</blockquote></div><br>