Expand description
Comprehension spec evaluation — text → typed value list.
§What this module does
A comprehension clause var in expr ships its expr as
free-form workload-author text. At runtime, the executor
needs to turn that text into a list of typed values to
enumerate over. That’s what evaluate_spec does, given a
Polydat Kernel that holds the in-scope name space (own outputs +
inherited externs from materialize_wiring_from_outer).
§Pipeline
spec_text
│
▼
interpolate_via_kernel ← {name} → kernel.lookup(name)
│
▼
eval_const_expr ← optional: Polydat expression eval
│
▼
parse_list_with_types ← comma-split, per-element type
│
▼
Vec<Value> ← what the executor enumerates§Where this used to live
Pre-Phase-C this code lived in the host. The lift was driven by the principle that Polydat is the canonical owner of what a comprehension means, including how its spec strings resolve (see comprehension_forms.md). The host now consumes this API rather than implementing it.
Functions§
- enumerate_
tuples - Enumerate the typed tuples a Cartesian comprehension produces.
- evaluate_
spec - Evaluate a comprehension clause’s spec text against a kernel.
- parse_
list_ with_ types - Parse a comma-separated text list, detecting each element’s
native type. SRD-18b’s “native types as the general rule”:
"1, 10"→[U64(1), U64(10)],"1.5, 2.5"→[F64(...)], mixed → each element gets its own native type. - pre_
evaluate_ clause - Pre-evaluate a clause’s spec text at synthesis time, using
probesfor prior clauses’ first values andworkload_paramsas a fallback source for names not yet promoted to workload- kernelconstbindings. - value_
to_ polydat_ type_ name - Map a
Valueto the canonical polydat extern type keyword.