Skip Headers

Oracle® Business Rules Language Reference 10g Release 3 (10.1.3) B15985-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# A Summary of Java and RL Differences

This appendix includes descriptions of differences between the RL Language and Java languages.

## A.1 RL Differences from Java

- RL does not include interfaces or methods.

- RL global variables are similar to Java static class variables, but there is one instance for each rule session.

- RL does not have a `static` keyword.

- RL has rulesets instead of packages. Rulesets group definitions and actions.

- Instances of RL and Java classes can be asserted as facts in working memory.

- RL facts are not garbage collected; they must be explicitly retracted.

- RL is interpreted. There is no compilation or class loading.The `include` statement can be used to read and interpret a ruleset at the given URL. Classes and functions must be defined before they are used.

- RL classes may not contain constructors or methods, only data fields. The data fields behave like Java bean properties.

- Java bean properties can be accessed as fields in RL.

- The `new` operator can explicitly assign values to named properties, regardless of whether or not a constructor is defined. The `fact` operator can match values to named properties and retrieve, using the `var` keyword, values from named properties. A property is either a Java bean property, for Java objects, or a field, for RL objects.

- RL arrays are limited to one dimension.

- The `if` and `while` actions must be in a block, enclosed in curly braces (`{``}`).

- RL does not include a `switch` action, `continue` statement, `break` statement, or labeled statements for breaking out of nested loops.

- An RL for loop cannot contain multiple comma separated initialization or update expressions.

- RL does not support bitwise `&` and `|` operators.

- RL supports function overloading and Java method overloading using first fit.

- RL variables must be initialized when they are defined.

- For RL and Java objects, `==` always invokes the object `equals` method. RL does not allow testing for object reference equality. For objects,`!=` does not test for inequality of object references, but rather is the negation of the equals methods.

  Thus, the statement:

      if (object1 != object2){}

  Is equivalent to the statement:

      if (! (object1.equals(object2)){}

- Forward references to classes or functions is not allowed.