Expand description
{name}-style template interpolation against a Polydat Kernel.
Polydat’s one name-resolution surface (expression_engine.md §3.2). It lives in the kernel module because the operation is a general kernel facility, not a comprehension concern: the comprehension runtime uses it, synthesisers use it, and the executor uses it, and none of them depends on the comprehension AST’s shape.
§Functions
interpolate_via_kernel— looks up{name}placeholders against the kernel’s chain-aware bindings viaPolydatKernel::lookup.interpolate_with_lookup— the generic engine; thelookupclosure decides where each leaf’s value comes from. Used by callers that compose their own lookup over the kernel plus workload params plus synthesis-time probes.collect_string_interp_refs— extracts the placeholder names from a text without doing substitution.
§Semantics
Iterative leaf-placeholder substitution with escape handling and a round cap:
- Leaf:
{name}whose body contains no further{. The dynamic form{a_{b}_c}is resolved by first substituting{b}, then re-scanning for the resulting{a_<b-value>_c}as a leaf. - Escape:
\{and\}pass through as literal{/}and are removed from the final string. - Round cap: if substitution doesn’t stabilize in
ROUND_HARDiterations, returns Err (the input had cyclic placeholders). - Unresolved name: any
{name}that survives the substitution rounds errors with a diagnostic naming the missing binding.
Structs§
- Kernel
Lookup - A kernel of any engine, as a scope names resolve in.
- Layered
- Bindings in front of another lookup: a tuple’s elements over the scope they were drawn in.
- NoScope
- The empty scope: no name resolves in it, and what has to compile under it is charged to the ledger it holds. A context-free source, one whose expression references no name, evaluates in this scope (comprehension_forms.md §10.7.0), at compile time or wherever no kernel is at hand.
Traits§
- Lookup
- Name resolution for comprehension sources and predicates: what a
{name}placeholder or a bare identifier reads. The interpreter kernel is one; aLayeredview puts a tuple’s bindings in front of another, so opening a traversal needs no kernel of the engine that opens it (engines.md §3.6).
Functions§
- collect_
string_ interp_ refs - Extract every leaf
{name}placeholder mentioned inside string-literal contexts insrcintorefs. - interpolate_
via_ kernel - Interpolate
{name}placeholders againstkernel. - interpolate_
with_ lookup - Iterative leaf-placeholder substitution with escape handling,
round cap, and final unresolved-name check. The
lookupclosure decides where each leaf’s value comes from.