<br>   This is an old discussion. Single binding on &quot;or&quot; is a non-orthogonal special case on the language syntax that was introduced in the early days when we only had &quot;infix&quot; CEs. When we started to support prefix CE, the special case was not updated, and as a result, the single binding works only with infix.<br>
<br>   IMO, this syntax promotes bad practices and should be disallowed. Although, some people like it and it is still in there. Just to clarify why I think it promotes bad practice:<br><br>* When you have the same object type for all the patterns inside an &quot;or&quot; group, you should be using constraint connector ||, not the &quot;or&quot; CE. Using your example:<br>
<br>$t : Trigger( fa == 1 || == 2 ) // or any variation of the syntax.<br><br>   This keeps the network smaller and prevents unexpected behavior when the constraints are not mutually exclusive and in some cases people forget that the rule will fire once for each logical branch when using &quot;or&quot;.<br>
<br>* If the object types are different, then you can&#39;t use single binding anyway:<br><br>$o  : ( Cheese() or Wine() ) // this will lead to ClassCastExceptions on the usage of $o.<br><br>   So, I really think that the &quot;single binding or&quot; fulfilled its purpose on Drools 3, when we didn&#39;t had all the flexibility in the language we have today. But now, the only thing it achieves is promoting bad practices.<br>
<br>   Just my 0.02c.<br><br>   []s<br>   Edson<br><br><div class="gmail_quote">2009/3/16 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
As far as I know, this should work:<br><br>package orel;<br>import orel.Main.Trigger;<br>rule ror1<br>    when<br>        $t : (or Trigger(fa == 1)<br>                 Trigger(fa == 2))<br>    then<br>        System.out.println( &quot;fired &quot; + $t.getName() );<br>

end<br><br>This is what Drools-5.0.0 kbuilder.getErrors().toString() returns:<br><br>[5,11]: [ERR 102] Line 5:11 mismatched input &#39;Trigger&#39; expecting &#39;(&#39; in rule ror1 in pattern or[6,14]: [ERR 102] Line 6:14 mismatched input &#39;Trigger&#39; expecting &#39;)&#39; in rule ror1[6,30]: [ERR 102] Line 6:30 mismatched input &#39;)&#39; expecting &#39;then&#39; in rule ror1<br>

<br>Shouldn&#39;t toString() insert line ends? As it is, the result is pretty much useless.<br><br>This works:<br>rule ror1<br>    when<br>        (or $t : Trigger(fa == 1)<br>            $t : Trigger(fa == 2))<br>    then<br>

        System.out.println( &quot;fired &quot; + $t.getName() );<br>end<br><font color="#888888"><br>-W<br><br>
</font><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>