Eval's are indeed less performatic than any other type of constraints. "inline-evals" are not as bad, but are also heavier than regular constraints.
The recommendation is to avoid when possible, but for some cases it is not possible.
If you are using MR3 or later, you can use MVELs syntax in your constraints:
when
MyClass( aMapAttribute['aKey'] == "some Value" )
then
...
end
The above will transparently be translated to an inline-eval, but that is the best you can do when working with maps.
[]s
Edson
2007/7/2, Rajesh_Kumar <Rajesh_Kumar@rsystems.com>:
Hi all,
I want to use "eval" in my rules, but in rule writing guidelines Mark
has
Written that "Eval is Evil".
I want to compare the values of Hash Map in my when (conditions) part.
1) Will anyone suggest something so that I can compare Hash Map keys in
when part?
2) Does is there any performance related issue related to "eval";
Regards
Rajesh
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com