<br>&nbsp;&nbsp; Joshua,<br><br>&nbsp;&nbsp; The limitation is on binding variables on different fact types on different logical branches and using them in the consequence. If you don&#39;t use the bindings in the consequence, you are fine.<br>
<br>&nbsp;&nbsp; This is a temporary limitation.<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div><span class="gmail_quote">2008/3/7, Joshua Undesser &lt;<a href="mailto:jundesse@cdmtech.com">jundesse@cdmtech.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br> Thank you Mark for the quick reply.&nbsp;&nbsp; I am curious if this is only temporary<br> or if this is the protocol that Drools is going to use for &quot;or&quot; statements?<br> The reason I ask is that i come from a jess/clips background, where &quot;or&quot; can<br>
 be used across multiple classes as shown in my example and it is very useful<br> when you have two huge rules that are identical except for one LHS class<br> pattern difference.<br> <br> Obviously the fix for now is to break up the rule into two rules, but I was<br>
 curious if this was only a temporary restriction or if this is going to be<br> the standing protocol?<br> <br> I&#39;ll also grab the new 4.0.5 branch as you mentioned and give that a whirl.<br> <br> Thanks again Mark!<br>
 <br> Joshua<br> <br><br> <br> <br> <br> <br> Mark Proctor wrote:<br> &gt;<br> &gt; The &#39;or&#39; must be used for classes of the same type.<br> &gt;<br> &gt; Mark<br> &gt; Joshua Undesser wrote:<br> &gt;&gt; I am curious if anyone else has run into this problem.....It seems like<br>
 &gt;&gt; there<br> &gt;&gt; is something wrong in the Drools Logic....My issue can be very easily be<br> &gt;&gt; recreated in about 5 minutes....<br> &gt;&gt;<br> &gt;&gt; &gt;From eclipse I set up a new drools project.&nbsp;&nbsp;&nbsp;&nbsp;Where DroolTest.java is<br>
 &gt;&gt; defined I create 4 new classes,&nbsp;&nbsp; ClassA, ClassB extends ClassA, ClassC<br> &gt;&gt; extends ClassA, and ClassD.<br> &gt;&gt;<br> &gt;&gt; Each of these classes has a default constructor that does nothing, there<br>
 &gt;&gt; are<br> &gt;&gt; no attributes or anything in these classes just to make the example<br> &gt;&gt; simple<br> &gt;&gt; to reproduce.&nbsp;&nbsp; Ie ClassA looks like this....<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; package com.sample;<br>
 &gt;&gt;<br> &gt;&gt; public class ClassA {<br> &gt;&gt;<br> &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public ClassA() {<br> &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &gt;&gt; }<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; Now within the DroolsTest.java source code at line 29 (ie right after the<br>
 &gt;&gt; workingMemory.insert( message ) method call I added 4 more lines which<br> &gt;&gt; creates and inserts two objects...<br> &gt;&gt;<br> &gt;&gt; ClassB classB = new ClassB();<br> &gt;&gt; ClassD classD = new ClassD();<br>
 &gt;&gt; workingMemory.insert( classB );<br> &gt;&gt; workingMemory.insert( classD );<br> &gt;&gt;<br> &gt;&gt; and then the next line would be the<br> &gt;&gt; workingMemory.fireAllRules();<br> &gt;&gt; as normal.<br> &gt;&gt;<br>
 &gt;&gt;<br> &gt;&gt; Then in the sample.drl file I add the following rule and functions<br> &gt;&gt;<br> &gt;&gt; 1 rule &quot;Test&quot;<br> &gt;&gt; 2&nbsp;&nbsp;&nbsp;&nbsp; when<br> &gt;&gt; 3<br> &gt;&gt; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$classA : ClassA()<br>
 &gt;&gt; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$classD : ClassD()<br> &gt;&gt; 6<br> &gt;&gt; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(or<br> &gt;&gt; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$classB : ClassB(eval($classB == $classA))<br> &gt;&gt; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$classC : ClassC(eval($classC == $classA))<br>
 &gt;&gt; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br> &gt;&gt; 11<br> &gt;&gt; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eval(retB($classA, $classD))<br> &gt;&gt; 13<br> &gt;&gt; 14&nbsp;&nbsp; then<br> &gt;&gt; 15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;\n\n&lt;&lt;FIRE RULE&gt;&gt;TEST&quot;);<br>
 &gt;&gt; 16 end<br> &gt;&gt; 17<br> &gt;&gt; 18 function boolean retA(Object obj) {<br> &gt;&gt; 19&nbsp;&nbsp; System.out.println(&quot;Ret Val = &quot; + obj);<br> &gt;&gt; 20&nbsp;&nbsp; return true;<br> &gt;&gt; 21 }<br> &gt;&gt; 22<br>
 &gt;&gt; 23 function boolean retB(Object obj1, Object obj2) {<br> &gt;&gt; 24&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;Ret Val 1 = &quot; + obj1);<br> &gt;&gt; 25&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;Ret Val 2 = &quot; + obj2);<br> &gt;&gt; 26&nbsp;&nbsp;&nbsp;&nbsp;return true;<br>
 &gt;&gt; 27 }<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; So what I am doing is very quick and very simple to reproduce.&nbsp;&nbsp; What is<br> &gt;&gt; happening is that when i run the program I am getting a class cast<br>
 &gt;&gt; exception<br> &gt;&gt; which is very very strange.<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; At first I thought it was tied only to the OR statement because if I<br> &gt;&gt; break<br> &gt;&gt; the rule into two rules (one for each of the or conditions) it works<br>
 &gt;&gt; fine.<br> &gt;&gt;<br> &gt;&gt; But after playing with it a little further I get a lot of other strange<br> &gt;&gt; class cast exceptions.<br> &gt;&gt;<br> &gt;&gt; For instance if I replace line 12 (eval(retB($classA, $classD))) with<br>
 &gt;&gt; eval(retA($classA))&nbsp;&nbsp;it works fine, but if I replace it with<br> &gt;&gt; eval(retA($classD)) I get another class cast exception.&nbsp;&nbsp;&nbsp;&nbsp;Another<br> &gt;&gt; strainge<br> &gt;&gt; issue....if switch lines 4 and 5 and keep line 12 as eval(retA($classD))<br>
 &gt;&gt; that previously failed, it now passes, but if I change line 12 back to<br> &gt;&gt; eval(retA($classA)) which previously passed it now fails.....<br> &gt;&gt;<br> &gt;&gt; There are a few other combinations that produce errors as well.&nbsp;&nbsp;Just<br>
 &gt;&gt; seems<br> &gt;&gt; to be a fundamental flaw in the logic and I&#39;m curious if anyone else has<br> &gt;&gt; seen this?<br> &gt;&gt;<br> &gt;&gt; Thanks!<br> &gt;&gt;<br> &gt;&gt; Joshua<br> &gt;&gt;<br> &gt;&gt; P.S.<br>
 &gt;&gt;<br> &gt;&gt; Also I&#39;ve noticed an issue with the manual example 6.36<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; This does not seem to work for me<br> &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pensioner : (or Person( sex == &quot;f&quot;, age &gt; 60 )<br>
 &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Person( sex == &quot;m&quot;, age &gt; 65 ) )<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; But this does<br> &gt;&gt; (or pensioner : Person( sex == &quot;f&quot;, age &gt; 60 )<br> &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; pensioner : Person( sex == &quot;m&quot;, age &gt; 65 ) )<br>
 &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; Although both formats are stated as working in the manual.<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;<br>
 &gt; _______________________________________________<br> &gt; rules-users mailing list<br> &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br> &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
 &gt;<br> &gt;<br> <br> <br>--<br> View this message in context: <a href="http://www.nabble.com/Problem-passing-objects-to-a-method-via-the-eval-statement-tp15885523p15898856.html">http://www.nabble.com/Problem-passing-objects-to-a-method-via-the-eval-statement-tp15885523p15898856.html</a><br>
 <br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br> <br> _______________________________________________<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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br> </blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;JBoss Drools Core Development<br>
&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>