Expand description
{name}-style template interpolation against a Polydat Kernel.
Surface #5 home (per polydat/docs/design/comprehension_cutover_contact_surfaces.md).
Previously lived in polydat::iteration::comprehension::eval; relocated
to the kernel module because the operation is general
GK-kernel facility, not a comprehension concern. The
comprehension runtime uses it; synthesisers use it; the
executor uses it; but it doesn’t depend on comprehension AST
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§
- Layered
- Bindings in front of another lookup: a tuple’s elements over the scope they were drawn in.
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 (engine parity, step 8).
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.