Skip to content

Aether 30.1 — operator sections (+ fix a latent JS-backend bug they surfaced)#674

Merged
github-actions[bot] merged 1 commit into
mainfrom
claude/hopeful-keller-96sfig
Jul 24, 2026
Merged

Aether 30.1 — operator sections (+ fix a latent JS-backend bug they surfaced)#674
github-actions[bot] merged 1 commit into
mainfrom
claude/hopeful-keller-96sfig

Conversation

@kkd16

@kkd16 kkd16 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Improves the existing aether-lang-c3d8 project. Single-project PR — every changed file lives under projects/aether-lang-c3d8/.

What changed

Adds operator sections — point-free style for map/filter/foldl — as pure parser sugar, desugared in parseParen to an ordinary lambda, so the type checker, the optimizer and all three backends (VM · JS · WASM) never see a section:

  • Bare operators (+), (*), (::), (|>)fn a b -> a op b (with |> keeping its reverse-application meaning) — ideal as a fold's combiner, foldl (+) 0.
  • Right sections (+ 1), (> 0), (:: xs), (^ "!")fn x -> x op e.
  • Field accessors (.field), chaining as (.a.b)fn r -> r.field — the row-polymorphic projector map (.name) wants.

Left sections are deliberately omitted (they read ambiguously against a partial application); subtract and flip are new prelude companions ((subtract 1) is the section - can't give, since (- 1) is negation). Aether's (* … *) block comments collide with a * section, so the lexer carves out the exact three-char (*) as bare multiply (so foldl (*) 1 xs lexes) and a * right section takes a space, ( * 2) — a documented, principled wart.

A real bug the differential suite caught

The VM ≡ JS check immediately flagged that a bare (op) x y — in fact any (fn …) arg at the top level — was miscompiled by the JavaScript backend: it emitted x => body(arg) for (x => body)(arg), so the argument was captured by the body instead of applied to the function. This is a pre-existing latent bug (it fails on (fn x -> x + 1) 5 on plain main) — sections just make the shape trivial to write. Fixed by parenthesising a lambda in function position; VM ≡ JS ≡ WASM holds for it again.

Verification

  • New 200-program section fuzzer (sectionFuzz.ts): random point-free pipelines proved against an independent TypeScript reference and the JS backend — 300/300 across four seeds.
  • New 16-case in-app sections battery — including the exact shapes that surfaced the JS bug; suite grows 166 → 182, WASM ≡ VM 150 → 166.
  • No regression: existing in-app suite 182/182, semantics 19/19, the comprehension fuzzer and the optimizer / SpecConstr / SROA fuzzers all still pass.
  • Full CI gate (scripts/verify-project.mjs: scope + conformance + lint + tsc + build) green locally.

A new gallery "Operator sections" example; About feature-list, parser-note and stdlib updates; JOURNAL.md carries the plan and a session-log entry.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BSXUJbL86qsEW8zJqvUppq


Generated by Claude Code

…urfaced)

Adds operator sections as pure parser sugar, desugared in parseParen to a lambda
(so the type checker, optimizer and all three backends never see them):

- bare operators (+), (*), (::), (|>) => fn a b -> a op b;
- right sections (+ 1), (> 0), (:: xs) => fn x -> x op e;
- field accessors (.field), chaining as (.a.b) => fn r -> r.field.

Left sections are omitted (ambiguous vs partial application); subtract/flip are
new prelude companions. The (* *) block-comment syntax collides with a * section,
so the lexer carves out the exact (*) as bare multiply and a * right section takes
a space, ( * 2).

The VM≡JS differential check immediately caught a pre-existing JS-backend bug: a
lambda in function position was emitted unparenthesised, so (fn x -> x + 1) 5
compiled to x => body(arg) instead of (x => body)(arg) and the argument was
captured by the body. Fixed by parenthesising a lambda in call position; VM≡JS≡WASM
holds again.

Verification: new 200-program section fuzzer (sectionFuzz.ts) vs an independent
reference and the JS backend; 16-case in-app `sections` battery (suite 166 -> 182,
WASM 150 -> 166); a gallery example; About/stdlib updates. No regression.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BSXUJbL86qsEW8zJqvUppq

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Scope + lint + build passed.

@github-actions
github-actions Bot merged commit a80f8f7 into main Jul 24, 2026
2 checks passed
@github-actions
github-actions Bot deleted the claude/hopeful-keller-96sfig branch July 24, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants