5bb721178f
Post-audit downstream-LLM-author field test of the post-removal Form-A surface. 4 fresh real-world programs written from DESIGN.md + form_a.md + public examples only (no compiler source): running sum-of-squares accumulator (loop/recur → 385), grade cascade (let-threaded if → 4/2/0), Horner polynomial straight-line build-up (let-shadow chain → 73), multi-state bracket scanner threading (rest,depth,ok) by tail recursion → true/false. 0 bugs, 0 friction, 0 spec_gap, 4 working — every task clean and correct on the first try with only let/if/loop/recur; all parse|render|parse byte-identical; zero mut/var/assign tokens produced (a doc-faithful author did not reach for the removed construct). The closest-to-friction case (multi-state machine restates the full state tuple per tail-call) is correctly classified working, not a spec_gap: that explicit-dataflow cost is the local-reasoning pillar working as designed; mut's implicit cross-iteration persistence is exactly the failure class the removal eliminates. mut-keyword rejection is fail-closed with a diagnostic that enumerates the surviving forms (no tombstone, no-nostalgia, as spec'd). Removal thesis empirically CONFIRMED — mut was redundant with let/if/loop/recur in 100% of the fresh tasks. The remove-mut-var-assign milestone is fully ratified and CLOSED: spec+plan+iter, audit clean (architect [high] form_a.md fixed in .tidy, bench causally exonerated), fieldtest clean. Roadmap P0 flipped [~]→[x]; WhatsNew user-facing entry appended.
39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
; Axis: conditional classification an imperative author writes as
|
|
; "set a code variable through a cascade of if-branches".
|
|
;
|
|
; Imperative instinct (the shape `mut` would invite):
|
|
; g = 0 ; 0=F
|
|
; if score >= 60: g = 1 ; D
|
|
; if score >= 70: g = 2 ; C
|
|
; if score >= 80: g = 3 ; B
|
|
; if score >= 90: g = 4 ; A
|
|
; return g
|
|
;
|
|
; Surviving-surface shape: either a let-threaded `g` updated by
|
|
; nested `if`, or a single nested `if` cascade. Both are pure
|
|
; expressions; the `mut` flag was never needed.
|
|
; grade(95)=4 (A), grade(72)=2 (C), grade(50)=0 (F).
|
|
; Expected stdout (per line): 4, 2, 0
|
|
|
|
(module remove-mut_2_grade_cascade
|
|
|
|
(fn grade
|
|
(doc "Letter-grade code (4=A..0=F) from a numeric score, written as the let-threaded equivalent of a mutable cascade.")
|
|
(type (fn-type (params (con Int)) (ret (con Int))))
|
|
(params score)
|
|
(body
|
|
(let g 0
|
|
(let g (if (app >= score 60) 1 g)
|
|
(let g (if (app >= score 70) 2 g)
|
|
(let g (if (app >= score 80) 3 g)
|
|
(let g (if (app >= score 90) 4 g)
|
|
g)))))))
|
|
|
|
(fn main
|
|
(type (fn-type (params) (ret (con Unit)) (effects IO)))
|
|
(params)
|
|
(body
|
|
(seq (app print (app grade 95))
|
|
(seq (app print (app grade 72))
|
|
(app print (app grade 50)))))))
|