Resolves subject slots to values at evaluation time.
A CompiledRule receives a RuleScope and reads each slot it
needs (e.g. the current user, the object in context). Each scope
resolves slots its own way: by walking the DOM, by consulting a
session-wide default, or by reading from a fixed value bag. The
caller picks which strategy when they build the scope with
scope.
One method, get(slot). A primitive that needs more than one slot
calls get multiple times.
Each slot resolves in order from most specific to least: a per-call
override on scope wins first, then the closest
DOM ancestor that registered a value through
provideSubject, then a
session-wide default registered through
registerSubject. If none of
those answer, get returns undefined and primitives reading the
slot return false.
Resolution is pull-based, not reactive: a RuleScope answers the
current value on each get call but does not notify when a value
changes. Re-evaluating a rule when its inputs change is the
caller's responsibility.
Resolves subject slots to values at evaluation time.
A CompiledRule receives a
RuleScopeand reads each slot it needs (e.g. the current user, the object in context). Each scope resolves slots its own way: by walking the DOM, by consulting a session-wide default, or by reading from a fixed value bag. The caller picks which strategy when they build the scope with scope.One method,
get(slot). A primitive that needs more than one slot callsgetmultiple times.Each slot resolves in order from most specific to least: a per-call override on scope wins first, then the closest DOM ancestor that registered a value through provideSubject, then a session-wide default registered through registerSubject. If none of those answer,
getreturnsundefinedand primitives reading the slot returnfalse.Resolution is pull-based, not reactive: a
RuleScopeanswers the current value on eachgetcall but does not notify when a value changes. Re-evaluating a rule when its inputs change is the caller's responsibility.Example
Reading a slot inside a primitive's predicate
See
RuleScope.