Language change process
Anything that changes what a valid program means, or adds a way to write one, goes through a short written proposal before it is implemented. The goal is to catch conflicts with C, with the generated code, and with existing programs while the change is still cheap.
What needs a proposal
- new syntax or keywords;
- a change to what existing syntax does, including type-checking rules that accept or reject different programs;
- a change to the generated C that other code can depend on: names of emitted functions and types, struct layouts, the exported header (see stability);
- a new
moxy.yamlkey or a change to its meaning; - removing anything.
What doesn't
Bug fixes that make the compiler match its documentation, better diagnostics, new standard library functions that don't need new syntax, tooling, performance work that leaves the output's meaning alone, and docs. Open an issue or a pull request directly.
Process
- Discuss first. Open an issue describing the problem, with real code that is painful today. A proposal that starts from a solution without a problem is sent back.
- Write the proposal. Copy template.md to
docs/proposals/<number>-<name>.mdusing the next unused number and a lowercase name with no spaces (for example0004-slices.md; the number keeps the order, the name keeps it findable). Keep it short. If it needs more than two pages, it probably contains more than one change. - Open a pull request adding only that file. Discussion happens on the pull request. Revise the file as the discussion converges; don't leave decisions in comment threads only.
- Decision. A maintainer sets the status line to
accepted,rejectedorwithdrawnand merges, with a one-paragraph reason. Rejected proposals stay in the repository so the question isn't asked again without new information. - Implement. An accepted proposal can be implemented by anyone. The implementation pull request links the proposal and includes tests, the reference and grammar updates, and a line in
docs/changes.md. - Shipped. When a release contains it, the status becomes
implementedand names the version.
Status values: draft, accepted, rejected, withdrawn, implemented.
What a proposal must answer
The template asks for these. A proposal that skips one is incomplete.
- What breaks. Does any existing valid C or Moxy program change meaning or stop compiling? Valid C keeps its C meaning; that's a rule, not a preference.
- What it compiles to. Show the C for a small example. If it needs runtime type information or unreadable output, say why.
- What the compiler pays. Self-compile time stays under the budget in the roadmap. Say what the feature adds to it.
- How it's tested. Name the tests, including the ones that must fail to compile.
- What it doesn't do. The limits, stated plainly.
Design documents
docs/design holds larger decisions that cover several features at once. They go through the same process: they are proposals that grew. A change that departs from one of them updates it in the same pull request.