Skip to main content

Module interp

Module interp 

Source
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

§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_HARD iterations, 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§

KernelLookup
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; a Layered view 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 in src into refs.
interpolate_via_kernel
Interpolate {name} placeholders against kernel.
interpolate_with_lookup
Iterative leaf-placeholder substitution with escape handling, round cap, and final unresolved-name check. The lookup closure decides where each leaf’s value comes from.