[rules-users] Constants

Wolfgang Laun wolfgang.laun at gmail.com
Tue Feb 28 01:53:16 EST 2012


@Davide,

there is *nothing* in Drools that is a full-fledged replacement for eitherr
  #define LIMIT 100
as in C, or
  const magic = 4711;
as in Pascal, or..., or...

Any modern programming language has this facility, and templates
are no replacement, and globals still need Java code for their initialization
prior to the insertion of any facts.

@Richard

Using some sort of parameter fact is another workaround, although this
requires an additional CE in rules requiring such a "constant".

Also, a simple Java class containing just global final statics could alse easily
(Java-)compiled and deployed with DRL packages importing these
constants. (Besides, many constants are related to Java classes and that's
where they ought to be declared anyway.)

-W

On 27/02/2012, Davide Sottara <dsotty at gmail.com> wrote:
> If you think of how RETE works, Globals serve as constants at runtime.
> If you need compile-time "constants", you might consider rule templates
> instead
> Best
> Davide
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Constants-tp3780878p3782094.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list