ADR-258: Four Weights for a Design Question

Status: Accepted Date: September 30, 2026 Answers: how a question that is too technical for the owner to decide case by case is prepared for the owner: the owner’s own statement of the language’s philosophy, given when the former open-decisions.md asked whether ?? takes its left side Related: ADR-094 D1 (the caller writes no &: the first place the second weight was applied), ADR-283 D3 (nothing large is copied behind the program’s back), ADR-276 (a keyword is the most expensive thing a language adds)

1. Context

Many of this language’s open questions are technical: what an operator does to its operand, which lowering a shape gets, where a cost lands. The owner decides at another level, cost against benefit, and some of these questions have long histories in the compiler, where the right handling differs from case to case. What the owner gives instead of a case-by-case answer is the philosophy the answers follow. A question prepared for the owner is weighed against it, and a recommendation says which weight decided it.

2. Decisions

D1 — The special case carries the cost, not the common one

Where a rule has to cost something, the cost falls on the uncommon shape. The common shape stays short, free and unannotated. A program that does the usual thing never pays for a program that does something unusual.

D2 — The compiler works for the developer, not the developer for the compiler

What the compiler can work out, it works out: a lent argument’s reference (ADR-094 D1), a number’s type (ADR-285), a box (ADR-246). The developer writes what only the developer knows. A rule that asks the program to spell something the compiler could have derived needs a reason stronger than making the compiler simpler.

D3 — Zero overhead for the common case

The common case costs what the same program would cost written by hand in the language below, and no more: no copy, no count, no check the program did not ask for. The language means to hold its own in a benchmark against other languages, and to beat them where it can. Where a guarantee has a run-time price, D1 decides who pays it.

D4 — The language is consistent with itself

A rule reads the same wherever its shape appears. Two constructs that do the same thing to a value do it the same way, so what a reader learns in one place holds in the next. A special case the compiler needs is the compiler’s, and it does not become a second rule the program has to know.

D5 — How a question is prepared

An issue labelled decision that the owner would otherwise have to judge technically names, for each option, what it costs under D1–D4: who pays, what the developer writes, what the program costs when it runs, and where it reads differently from a neighbouring rule. The recommendation is the option that costs least by them, and it says which weight decided where two pull apart.

3. Consequences

The weights do not replace a decision; they make one small enough to take. Where they point one way, the entry says so plainly. Where they disagree, D3 and D1 describe the language’s promise to a program and D2 and D4 its promise to a reader, and the entry says which of the two is being traded.

This site is open source. Improve this page.