Values and types · rule
type.rule_outside_fields
Rule reads something besides its type's fields.
Area 2, Values and types; not declinable; the next step is usually the agent's.
A rule reads only its type's fields, so every value of the type follows it wherever it is made, the same in every run: no function of the application, constant, setting, clock or record:
type Moment = Instant {}type Booking = Object { starts: Moment ends: Moment rule in_opening_hours: opens_by(starts)}type Opens = Bool {}function opens_by(at: Moment) -> Opens { return Opens(true)}
error: A rule can't read `opens_by(starts)` --> main.jadpo:6:28 |6 | rule in_opening_hours: opens_by(starts) | ^^^^^^^^^^^^^^^^ not one of the type's fields reason: A rule reads only `Booking`'s own fields, with literals, variants, operators, `match` and the standard operations that give a result from their arguments alone, so every value of `Booking` follows it wherever it is made, the same in every run. next: Write the rule over `Booking`'s fields, or check this where the value is built, before building it (agent) rule: type.rule_outside_fields help: https://jadpo.dev/docs/errors/type.rule_outside_fieldscheck failed: 1 error, 1 file
Markdown for agents: /docs/errors/type.rule_outside_fields.md.Built from Jadpo main at a707efb.