On 15 January 2011 11:32, Evert Penninckx <span dir="ltr">&lt;<a href="mailto:evert.penninckx@gmail.com">evert.penninckx@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I thought I had an error from the drools plugin when using instanceof even<br>
in eval, but I&#39;ll try that again, I think I tried eval(this instanceof ...).<br></blockquote><div><br>You cannot use this in an eval. The eval is &quot;moved out&quot; from the containing pattern,<br>and there this has no meaning.<br>
 <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Overloading getLikes() would be more elegant. Still, for me these are<br>
workarounds.<br>
<br>
Would it be that strange or unconventional to have the from only match on<br>
the required subclass?<br></blockquote><div><br>Given that getLikes() is <i><b>your </b></i>choice of method producing the data, and that<br>FrenchCheese is <i><b>your </b></i>choice of type for the receiver: would it be that strange<br>
or unconventional to expect you to employ matching types? ;-)<br><br>Type checking should not result in the silent elimination of data at runtime. What<br>I would expect Drools to tell me is the incompatibility of the from and the receiving<br>
pattern, at compile time.<br><br>-W<br><br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Grtz<br>
<br>
Evert<br>
<br>
<br>
Wolfgang Laun-2 wrote:<br>
&gt;<br>
&gt; If smell is a property of Cheese and not just of FrenchCheese you could<br>
&gt; use<br>
&gt;<br>
&gt;<br>
&gt; when<br>
&gt;        $person : Person ()<br>
&gt;        $c: Cheese( eval( $c instanceof FrenchCheese), smell == &quot;good&quot; )<br>
&gt; from<br>
&gt; $person.getLikes()<br>
&gt; then<br>
&gt;<br>
&gt; Also, I think that a selective retrieval with an overloaded version of<br>
&gt; getLikes():<br>
&gt;    getLikes( Class clazz )<br>
&gt; might be useful, avoiding useless elements in the returned collection.<br>
&gt;<br>
&gt; -W<br>
&gt;<br>
&gt;<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/About-for-and-inheritance-tp54110p2260831.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/About-for-and-inheritance-tp54110p2260831.html</a><br>

Sent from the Drools - User mailing list archive at Nabble.com.<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>
</font></blockquote></div><br>