Interesting. I had never tried it without the ".class" static field in the class name. I need to investigate this a further but I think what is happening behind the scenes is that since you are using nested accessors (option.class), it is getting transparently re-written into an inline eval(). This should not be a big deal, since you don't have (I guess) too many classes and indexing/hashing would not help you that much either. So I guess performance is probably the same, but as you said, more readable.

   Question: what is the actual type of your "option" field? I mean, what class does getOption() returns? Object?

   []s
   Edson


2008/5/24 Barry Kaplan <groups1@memelet.com>:

Edson, I do not assert the Instruments, on the Positions which contains
multiple Instruments. I an trying to match Option Positions (ie, Positions
that contain one or more Option legs).

What I did was...

when
   position : Position(option : instrument, option.class ==
OptionInstrument)

...and this works correctly. Is the above more or less efficient than using
eval or the from-clause? It certainly is easier to read.

thanks!

-barry
--
View this message in context: http://www.nabble.com/Matching-on-instanceof-without-eval--tp17425953p17453068.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com