Files
AILang/examples/rc_pin_recurse_implicit.ail
T
Brummel 72e54f4fd3 iter ext-rename: .ailx → .ail across the live toolchain
The surface-form file extension changes from .ailx to .ail. AILang's
authoring surface now uses the same .ail stem as its canonical JSON
form (.ail.json), giving the language a single coherent extension
family: .ail is the LLM-authored Form A, .ail.json is the canonical
JSON-AST Form B.

Scope (touched):
- 61 example renames examples/**/*.ailx → .ail (git mv)
- 1 rename experiments/.../rendered/ailx.md → ail.md
- 35 content-edited live-toolchain files (crates/, docs/DESIGN.md,
  docs/roadmap.md, docs/PROSE_ROUNDTRIP.md, skills/, bench/reference/*.c,
  experiment crates under experiments/.../{render,harness,master})
- Experiment-crate cohort rename Cohort::Ailx → Cohort::Ail,
  Form::Ailx → Form::Ail, per_cohort/ailx → per_cohort/ail,
  {form-only: ailx} → {form-only: ail}, ```ailx → ```ail

Out of scope (deliberately untouched, to preserve honest history):
- docs/journal-archive.md (content-frozen per CLAUDE.md)
- docs/journals/, docs/specs/, docs/plans/, bench/orchestrator-stats/
- experiments/.../runs/ (frozen LLM-output artefacts; models actually
  saw .ailx — renaming would falsify the experimental record)

Verification: cargo build/test --workspace green; experiment crate
cargo test green; bench/check.py + compile_check.py + cross_lang.py
all 0-regressed; negative grep for ailx|Ailx|AILX outside the
out-of-scope paths returns zero matches.

Opens immediate follow-up: roadmap.md P2 todo `ail check`/build/run
accept .ail extension — after this rename, .ail is canonical
authoring surface but the CLI still produces a misleading JSON-parse
error on `ail check foo.ail`. That's the next iter.
2026-05-12 14:20:27 +02:00

56 lines
1.6 KiB
Plaintext

; Iter 18d.4 regression fixture: under --alloc=rc, codegen's
; "pattern-binder dec at arm close" (Iter A) was firing on
; pattern-bound pointer fields whose enclosing fn is Implicit-
; mode. Result: a free of memory the caller still references.
;
; Symptom under --alloc=rc before the fix:
; - Implicit-mode pin/loop: refcount underflow at runtime.
; - Same code under --alloc=gc: clean exit, prints `0`.
;
; Pattern shape: a heap-allocated value `t` shared between a
; callee that pattern-destructures it (pin) and a recursive
; call that re-passes it (loop). Pattern arm binds the children
; (l, r) without consuming them — pre-fix, codegen emitted a
; drop on each, freeing memory still referenced via the outer
; let-binder `t`.
(module rc_pin_recurse_implicit
(data Tree
(ctor TLeaf)
(ctor TNode (con Int) (con Tree) (con Tree)))
(fn build
(type (fn-type (params (con Int)) (ret (con Tree))))
(params d)
(body
(if (app == d 0)
(term-ctor Tree TLeaf)
(term-ctor Tree TNode 1
(app build (app - d 1))
(app build (app - d 1))))))
(fn pin
(type (fn-type (params (con Tree)) (ret (con Int))))
(params t)
(body
(match t
(case (pat-ctor TLeaf) 0)
(case (pat-ctor TNode v l r) 1))))
(fn loop
(type (fn-type (params (con Int) (con Tree)) (ret (con Int))))
(params n t)
(body
(if (app == n 0)
0
(let _v (app pin t)
(app loop (app - n 1) t)))))
(fn main
(type (fn-type (params) (ret (con Unit)) (effects IO)))
(params)
(body
(let t (app build 2)
(do io/print_int (app loop 3 t))))))