[rules-users] Autoboxing

Edson Tirelli tirelli at post.com
Tue Feb 27 06:08:10 EST 2007


   Hi,
 
   Yes, primitive supported was added to 3.1 version. No more 
auto-boxing/unboxing. That also means improved performance. See:

http://jira.jboss.com/jira/browse/JBRULES-527

   A side note is: most times, when doing automatic translation from 
other engines to JBoss Rules (or engines that support eval/test CE), the 
translator abuses of eval(). It is really important that people 
understand that eval() is "evil" :). It is surelly easier to use when 
doing automatic translation, but from a runtime perspective, your rules 
may really suffer from performance issues. Sometimes it is worth to 
invest a bit more time in the translator, or simply have a second "step" 
where you manually adjust your rules to use other types of constraints 
as a way to improve your rules. There are several reasons, but I would 
say that immediate and future leverage through optimizations is the main 
one.
   Just sharing the worry.
  
   []s
   Edson

wernejen at TU-Cottbus.De wrote:

>Hi everbody,
>
>I'm trying to translate an other rule-language in JBossRules (with
>XSL(T)).
>One of my major problems is the autoboxing- without unboxing-support in
>the engine.
>I think it is a general problem, because (1) everyone who is writing a
>rule has to know what types the properties in the objects (beans)
>to be used are. I think it is enough to know is it a digit, a boolean
>or... The trouble begins in an evaluation:
>
>when
>  Person ($age1 : age, name == 'Mike')
>  Person ($age2 : age, name == 'Peter')
>
>  eval ($age1 > $age2)                       // !!! it's wrong
>  eval ($age1.intValue() > $age2.intValue()) // it's ok if the Objects
>                                             // are Integer and not
>                                             // Double or ...
>..
>
>I think a rule-creator without java-knowlege has only little
>understanding for this. (... and rules are for specialist from different
>domains???)
>
>(2) another conflict is in the different handling in fieldconstraints and
>evaluations.
>I can use all operators for simple types in field constraints but not in
>evaluations:
>
>
>when
>  Person (age > 20)  // here I use the field as a primintiv type
>  Person (age < 30)
>
>..
>
>I know that all of them based on java and oop and I need this knowledge
>for the RHS, but this confusion is not helpful for beginners or user
>from other domains.
>
>I don't know, what the reason for autoboxing (without unboxing
>especially in java 5) is.
>I'm confused by the documentation.
>(Drools Documentation: "... If you use Java 5, then you get the best of
>both worlds ..." (context autoboxing).
>Another line in the drool documentation: "All bound primitive
>declarations are boxed, there is currently no auto-unboxing (if you use
>java 5, this is all automatic).")
>
>Will the unboxing be supported in futur versions?
>(... or afford a possibility for switch off the autoboxing?)
>
>Thanks,
>-jens
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list