Named Values
A “named value” is what you might call a “variable” in other languages. The distinction is important, though. Aranya Policy Language is a static single assignment language. In a particular scope, a named value is defined once and never mutated. Some values may be predefined in some scopes, or inherited from enclosing scopes.
let x = 3
let x = 4 // Error - cannot redefine `x`
if foo is None {
let x = 5 // Can't shadow in an inner scope, either.
let y = x + 1 // `x` is inherited from the enclosing scope
}
Automatically defined named values
In some contexts, there are names automatically defined by the runtime.
- In
policy,recall, andsealblocks, the fields of the command are available via the namethis, which is of typestruct <CommandName>. - In
policy,recall, andopenblocks, the envelope of the command is available via the nameenvelope, which is an opaque type accessible via theenvelopeFFI.