design-md-consolidation 2.1: delete Decision 7 (Term::If REVERTED block)

This commit is contained in:
2026-05-10 12:23:49 +02:00
parent c352de8117
commit a3406394c2
-32
View File
@@ -590,38 +590,6 @@ server, LSP) was deferred — all three layer additively on the
static-prompt path ships, which remains the
lowest-common-denominator fallback that always works.
## Decision 7: redundancy removal — `Term::If` is not a primitive
This decision was made on shaky grounds —
applying CLAUDE.md's "no redundancies" rule to a case that turned out to
be primitive control flow, not redundancy. The post-removal match-on-Bool
form (3× the tokens, asymmetric `pat-wild` for the false case) was
worse for token economy and worse for the natural shape of the language.
`Term::If` is restored. The text below is preserved for the audit trail.
`Term::If { cond, then, else_ }` is semantically a subset of
`Term::Match` on `Bool`. Per CLAUDE.md the language must contain no
redundancies; two AST nodes for the same operation produces an
authoring decision with no semantic content and an extra codegen
path. `Term::If` was removed. Migration shape on the JSON side:
{"t":"if","cond":C,"then":A,"else":B}
{"t":"match","scrutinee":C,
"arms":[
{"pat":{"p":"lit","lit":{"kind":"bool","value":true}},"body":A},
{"pat":{"p":"wild"},"body":B}]}
The wildcard arm satisfies the typechecker's
`primitive-needs-wildcard` rule. A future iter may upgrade the
exhaustiveness check to recognise the `true`+`false` arm pair as
covering Bool without a wildcard; until then, wildcard is the
canonical migration target.
No schema version bump (no third-party consumes `ailang/v0`).
Hash invalidation for the three migrated fixtures (`sum`, `sort`,
`max3`) is intentional; the new hashes become the new identity.
## Decision 8: explicit, verified tail calls
For an LLM author, recursion is the natural iteration form