Expression Language (EL)
Overview
XWidget EL is a powerful expression language that enables dynamic evaluation of expressions within a structured data model. It supports arithmetic, logical, conditional, relational operators, and functions, allowing for complex calculations and decision-making.
Beyond evaluation, it supports model change notifications and model transformations, ensuring data-driven applications stay responsive, making it ideal for UI updates, workflow automation, reactive processing, real-time computation, and dynamic content adaptation.
Evaluation Rules
Below is the operator precedence and associativity table. Operators are executed according to their precedence level. If two operators share an operand, the operator with higher precedence will be executed first. If the operators have the same precedence level, it depends on the associativity. Both the precedence level and associativity can be seen in the table below.
| Level | Operator | Category | Associativity |
|---|---|---|---|
| 11 | identifier 'string' 123 |
Primary Expressions (references, string literals, numbers) | N/A |
| 10 | ()[]. |
Function call, scope, array/member access | Right-to-left |
| 9 | -expr!expr |
Unary Prefix (negation, NOT) | Left-to-right |
| 8 | */~/% |
Multiplicative Operators | Left-to-right |
| 7 | +- |
Additive Operators | Left-to-right |
| 6 | <><=>= |
Relational Operators | Left-to-right |
| 5 | ==!= |
Equality Operators | Left-to-right |
| 4 | && |
Logical AND | Left-to-right |
| 3 | || |
Logical OR | Left-to-right |
| 2 | expr1 ?? expr2 |
Null Coalescing (If null) | Left-to-right |
| 1 | expr ? expr1 : expr2 |
Conditional (ternary) Operator | Right-to-left |
Important
Strings must be enclosed in single quotes ('). Double quotes (") are not supported.