Skip to main content

Module eval

Module eval 

Source
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§

NamedGenerator
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 Lookup scope.
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 probes for prior clauses’ first values and workload_params as a fallback source for names not yet promoted to workload- kernel const bindings.
refused_generator_call
The refusal of the first named generator call in text that fails, looking through the arguments of the calls that enclose it (concat(fib(94), 1..3)), after {name} interpolation against kernel. 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). None when every named generator call in text expands, when an interpolation does not resolve, or when text calls none.
value_to_polydat_type_name
Map a Value to the canonical polydat extern type keyword.