Labels
Labels let you name rules and reference them from other rules, enabling composable policies.
If you want a reusable numeric calculation rather than a reusable boolean rule, see Computed Values.
Very Important Labels cannot have spaces in them.
Defining Labels
Section titled “Defining Labels”Add a label before the article. The label ends with a period:
AgeCheck. A **Person** passes the age check
if __age__ of **Person** is greater than or equal to 18.Labels can use dot notation for hierarchical naming:
theory.check. A **Person** passes the theory test
if __theory_score__ of **Person** is greater than or equal to 43.
practical.check. A **Person** passes the practical test
if __practical_score__ of **Person** is greater than or equal to 40.Referencing Labels with §
Section titled “Referencing Labels with §”Use § (or $) to reference a labeled rule from another rule:
A **Person** passes the full test
if §theory.check passes
and §practical.check passes.The § reference evaluates the referenced rule and uses its result as a condition.
Label Predicates
Section titled “Label Predicates”When referencing a label, you can use a predicate to describe the expected outcome:
| Predicate | Example |
|---|---|
passes | §ageCheck passes |
succeeds | §theory.check succeeds |
clears | §backgroundCheck clears |
qualifies | §eligibility qualifies |
meets requirements | §minimumAge meets requirements |
satisfies | §criteria satisfies |
is valid | §emailCheck is valid |
is approved | §review is approved |
has passed | §exam has passed |
is authorized | §access is authorized |
is certified | §training is certified |
is permitted | §action is permitted |
is satisfied | §condition is satisfied |
Negated References
Section titled “Negated References”You can check that a labeled rule fails by using a negated predicate:
A **User** is denied if §eligibilityCheck fails.This evaluates the referenced rule and inverts the result — if eligibilityCheck returns false, the negated reference returns true.
| Negated Predicate | Example |
|---|---|
fails | §check fails |
does not pass | §check does not pass |
does not succeed | §check does not succeed |
does not clear | §check does not clear |
does not qualify | §check does not qualify |
does not satisfy | §check does not satisfy |
does not meet requirements | §check does not meet requirements |
is not valid | §check is not valid |
is not approved | §check is not approved |
has not passed | §check has not passed |
is not authorized | §check is not authorized |
is not certified | §check is not certified |
is not permitted | §check is not permitted |
is not satisfied | §check is not satisfied |
You can combine not with a negated predicate for a double negation (which equals the positive check):
not §check failsThis is equivalent to §check passes.
Value References
Section titled “Value References”Alongside the boolean reference (§label / $label), a labeled rule can also expose a numeric value that other rules read with @label.
Exposing a value with @@(...)
Section titled “Exposing a value with @@(...)”Inside a labeled rule’s body, wrap an arithmetic expression in @@(...) to mark its result as the rule’s exposed value. @@(...) occupies one side of a comparison — it contributes to the rule’s truth condition and publishes its value at the same time.
bob. A **policy** is good
if @@(9 minus 7) is equal to 2.Here bob’s condition is 2 is equal to 2 (true), and bob’s exposed value is 2.
Reading a value with @label
Section titled “Reading a value with @label”From another rule, @label resolves to the exposed value and can be used anywhere a number is valid — comparisons, arithmetic, or inside math functions.
@label is a value-only reference: it does not count as “using” the labeled rule for connectivity. The labeled rule must still be reached by either a boolean label reference (§label / $label) or a selector-and-outcome reference (the **policy** is good), otherwise the parser reports multiple global rules.
Using $label:
Interactive Example
Using a selector-and-outcome reference:
Interactive Example
@label participates in arithmetic:
@bob + 1 is equal to 3And composes with math functions:
floor of (@bob / 2) is equal to 1Using property references inside @@
Section titled “Using property references inside @@”The expression inside @@(...) can reference the data object just like any other arithmetic expression:
Interactive Example
Errors
Section titled “Errors”If a rule uses @label but the referenced rule has no @@(...) in its body, evaluation fails with:
Computed value '@label' not found in arithmetic expressionFull Example
Section titled “Full Example”Interactive Example
Try changing status to "suspended" — the age check will pass but the status check will fail, causing the overall rule to fail.
Rule References (without labels)
Section titled “Rule References (without labels)”You can also reference rules by their outcome, without using labels:
A **user** passes the age check
if __age__ of **user** is greater than or equal to 18.
A **user** is eligible
if the **user** passes the age check.This form matches the rule by its selector and outcome text.