Repository navigation
Reference 14 for
Associates a newly created shape instance with the subject it's about:
Receipt for invoice sentOn: now
for <expr> matches by type, not name: whichever field on the created shape has a type matching <expr>'s type is the one populated — a field typed with a static union matches an expression of any operand's type (## Relationships). When a shape has more than one field of that type, name the field explicitly: Referral for referrer: this.referrer.
Inside a rule body, from { field: value, ... } is the general, clearer way to write this — every field as an ordinary, totality-checked mapping entry, with no field singled out syntactically:
Referral from {
referrer: this.referrer
referee: this.referee
referredOn: now
}
Creating an instance is an ordinary body statement, nothing more — no header annotation is involved. When the created shape serves as a guard witness, the connection to the trigger is the disarm proof's job, checked rather than spelled. for as a query expression ((NurseVerification for this).nurse, exists Shape for expr) is unaffected by this — see ## Predicate expressions, above.
Reference
- §1 Principles
- §2 Philosophy
- §3 shape
- §4 State and commits
- §5 Scalars
- §6 Relationships (one, many)
- §7 Derived properties
- §8 Refinements (where)
- §9 Composing refinements (and, or)
- §10 Predicate expressions
- §11 rule ... when ... on ...
- §12 Assignment (mutation in place)
- §13 Exit triggers (when leaving)
- §14 for
- §15 then
- §16 Sweeps: rules fire per record
- [[§17 Schedule triggers (on )|Reference-17-Schedule-triggers]]
- §18 Run-once guards
- §19 Self-referential folds and tolerates
- §20 State-change patterns
- §21 never
- §22 Open / unresolved
Normative documents
Guides
Notes