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_for ← optional: Polydat expression eval,
charged to scope.ledger()
│
▼
parse_list_with_types ← comma-split, per-element type
│
▼
Vec<Value> ← what the executor enumerates§Ownership
Polydat owns what a comprehension means, including how its source strings resolve (comprehension_forms.md §3.1). A host consumes this API rather than implementing it.
Enums§
- Named
Generator - A named generator: a call in source position that expands its literal arguments into a finite list of values (comprehension_forms.md §3.1.3, “Named generators”).
Functions§
- evaluate_
spec - Evaluate a comprehension clause’s spec text against a
Lookupscope. - parse_
list_ with_ types - Parse a comma-separated text list, detecting each element’s
native type, as element types are inferred
(polydat_grammar.md §16.3):
"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. - refused_
generator_ call - The refusal of the first named generator call in
textthat fails, looking through the arguments of the calls that enclose it (concat(fib(94), 1..3)), after{name}interpolation againstkernel. A named generator’s values depend on nothing but its arguments, so once they are resolved its failure is the call’s error wherever it is evaluated (comprehension_forms.md §3.1.3).Nonewhen every named generator call intextexpands, when an interpolation does not resolve, or whentextcalls none. - value_
to_ polydat_ type_ name - Map a
Valueto the canonical polydat extern type keyword.