You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload
8000
to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(control): bounded iteration in the strict core — recursion-with-cursor is unreviewable #267
Implemented in #269 (fix/issue-264-scaffold-containment).
Syntax shipped (per the note on #263 — authoring form now, revisable when the surface decision lands):
FOR EACH <var> IN <list> [WHERE <cond>]: ADD <expr> -> <binding>
FOR EACH <var> IN <list> [WHERE <cond>]: COLLECT <expr> -> <binding>
ADD accumulates from 0, COLLECT appends from []. Design constraints from the issue all held: bounded only (no WHILE in the core), explicit accumulator named in the step, both targets.
Both targets, via the IR. It lowers to a checked IRForEach node, so the type checker, effect/failure analysis and both emitters consume one structure. The capability gate now distinguishes a fold from an effect-only FOR each loop step, so folds are no longer refused on TypeScript. Scoping is enforced: the loop variable is scoped to the step (reading it afterwards is ESEM004), the target binding is visible after.
Corpus effect — the walkers are gone. Strict-clean examples 5/8 → 7/8:
example
before
after
sorting, sorting_ja, sorting_ts
3 comprehensions each
folds; all strict-clean
billing
[line-items-total] cursor walker
deleted, one fold
showcase
[science-total], [payload-total], [sampling-hours] — 7 lines each
Two latent TypeScript bugs surfaced and fixed. Once the sorting examples stopped being scaffolds they took the IR path for the first time, which exposed: return-type inference only recognised comprehensions as list producers (a COLLECT binding inferred number instead of number[]), and the IR path rendered list concatenation as JS +, which stringifies arrays. Both now covered by cross-target tests that execute quicksort on Node and compare against the Python artifact — worth noting these were reachable before this change by any IR-path module returning a concatenated list.
Not covered: the pairwise walkers [route-distance] and [build-legs] stay recursive. They carry the previous element across iterations, which a fold cannot express without tuples. A SCAN-shaped construct would fold them too; not proposed here.
Activity
fix(examples): bring arithmetic, billing, and strings to strict-clean
feat(control): add bounded iteration to the checked core
Mnehmos commentedon Sep 13, 2026
Implemented in #269 (
fix/issue-264-scaffold-containment).Syntax shipped (per the note on #263 — authoring form now, revisable when the surface decision lands):
ADDaccumulates from 0,COLLECTappends from []. Design constraints from the issue all held: bounded only (noWHILEin the core), explicit accumulator named in the step, both targets.Both targets, via the IR. It lowers to a checked
IRForEachnode, so the type checker, effect/failure analysis and both emitters consume one structure. The capability gate now distinguishes a fold from an effect-onlyFOR eachloop step, so folds are no longer refused on TypeScript. Scoping is enforced: the loop variable is scoped to the step (reading it afterwards is ESEM004), the target binding is visible after.Corpus effect — the walkers are gone. Strict-clean examples 5/8 → 7/8:
sorting,sorting_ja,sorting_tsbilling[line-items-total]cursor walkershowcase[science-total],[payload-total],[sampling-hours]— 7 lines eachJapanese surface included:
<list> の 各 <var> について [もし <cond>]: 合計|収集 <expr>.Two latent TypeScript bugs surfaced and fixed. Once the sorting examples stopped being scaffolds they took the IR path for the first time, which exposed: return-type inference only recognised comprehensions as list producers (a
COLLECTbinding inferrednumberinstead ofnumber[]), and the IR path rendered list concatenation as JS+, which stringifies arrays. Both now covered by cross-target tests that execute quicksort on Node and compare against the Python artifact — worth noting these were reachable before this change by any IR-path module returning a concatenated list.Not covered: the pairwise walkers
[route-distance]and[build-legs]stay recursive. They carry the previous element across iterations, which a fold cannot express without tuples. ASCAN-shaped construct would fold them too; not proposed here.21 new tests; suite 1219 passing.