feat: def/apply/export/step — reusable folding sequences, instances, panels #35

Merged
toph merged 22 commits from feat/step-defs into main 2026-07-03 00:39:22 +00:00
Owner

Implements the revised step/macro design (docs/superpowers/specs/2026-07-02-step-macros-design.md): def never runs, apply is the only execution form and yields a retained instance, export reads without re-running, step is a display-only panel marker. Binding separator is now =; _-prefixed temps rebind and stay invisible in FOLD; duplicate binding is an error everywhere. Qualified access .[$i m] / --[$i m] gives collision-free FOLD names (i.m).

Breaking: : bindings no longer parse — all examples, tests and the spec (§5a, since v0.16-dev) are migrated.

Resolves #29, resolves #24.

Implements the revised step/macro design (docs/superpowers/specs/2026-07-02-step-macros-design.md): `def` never runs, `apply` is the only execution form and yields a retained instance, `export` reads without re-running, `step` is a display-only panel marker. Binding separator is now `=`; `_`-prefixed temps rebind and stay invisible in FOLD; duplicate binding is an error everywhere. Qualified access `.[$i m]` / `--[$i m]` gives collision-free FOLD names (`i.m`). Breaking: `:` bindings no longer parse — all examples, tests and the spec (§5a, since v0.16-dev) are migrated. Resolves #29, resolves #24.
toph added 22 commits 2026-07-03 00:29:16 +00:00
Desugar .(l1 l2) to Cross and --(p1 p2) to Through in parser actions;
no new AST node types added.
Add scope/ctx types with innermost-first scope stack; thread ctx through
lookup_point, lookup_crease, bind_point, bind_crease helpers. Extract
eval_stmt as a named function. No behavior change — single-scope path is
identical to the old flat-hashtbl path. Adds test_scope_basic_lookup as
regression baseline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
Owner

Screenshots of the examples this PR touches — cube-root.bel restructured with step panels + _-temps (folded state unchanged, render byte-identical to the reference), def-diagonals.bel new def/apply demo. Note the qualified crease names d1.d / d2.d in the second diagram — collision-free FOLD naming from repeated apply.

cube-root.bel — crease pattern / folded

def-diagonals.bel — crease pattern

Screenshots of the examples this PR touches — `cube-root.bel` restructured with `step` panels + `_`-temps (folded state unchanged, render byte-identical to the reference), `def-diagonals.bel` new def/apply demo. Note the qualified crease names `d1.d` / `d2.d` in the second diagram — collision-free FOLD naming from repeated `apply`. **cube-root.bel — crease pattern / folded** ![](https://git.toph.so/attachments/afff9294-f95f-4a6d-8720-a0f48055aff4) ![](https://git.toph.so/attachments/87d9c853-2ef8-45d3-a55f-f0c760c5557f) **def-diagonals.bel — crease pattern** ![](https://git.toph.so/attachments/4ab212d1-9510-483f-9749-701e361dc0e1)
toph merged commit 7d353f24ca into main 2026-07-03 00:39:22 +00:00
toph deleted branch feat/step-defs 2026-07-03 00:39:23 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch!35
No description provided.