decisions DECIDED

324. The names of a message's words and a system call's result words

(The section number and title are provisional until the merge lands them. Ruled 2026-11-22 (UTC).)

Background

A nife message is a handful of 64-bit words carried in registers. SEND and CALL take up to three, a plain RECEIVE hands back five (the fifth written only by the kernel), and a dead child's label rides in a sixth. A system call answers in one or two result words, and a CALL's reply is two result words. Each contract decides what its words mean: in filesystem_contract, the first word of a READ packs the operation, the handle and the byte count, and the second word is the file offset. notes/abi.md lays the words out by position.

The tree names those positions w0 to w5 (the words of a message) and r0 to r2 (the result words), in doc prose and as parameter, local and field names. design/naming.md requires every name the tree authors to spell out its abbreviations, parameters included, so these names are refused. Spelled numbers (word_zero) and ordinals (first_word) are refused in identifiers too, and the tree must not permit them.

The rule

How nife names the words of a message and the result words of a system call, in identifiers and in prose, across nife, its std overlay and the kernel:

The reasons: an array leaves no numbered identifier to rule on, so the tree needs no convention for one. The compiler checks the position: words[3] on a [u64; 3] fails to build, where a name word_3 is only a name. And the tree already works this way. The trap boundary is raw_system_call(number, words: [u64; 6]) -> [u64; 6] and trap6(number, a: [u64; 6]), and the kernel's saved registers are x: [u64; 31]. A parameter words: [u64; N] appears 16 times in 12 files, three of them in const fn contract decoders.

This costs more than the refused digit form, since it changes signatures and call sites where a digit renames. The rule is chosen on the merits, not on effort.

Where an array fits badly, and what the rule does there

Code generation: why the wrappers carry #[inline]

Measured by compiling send, call and receive both ways, with each architecture's trap6 copied in and call returning (i64, u64). Callers' instruction counts, digits against arrays:

Build aarch64 riscv64 x86_64
opt-level=3, wrappers inlined identical identical identical
opt-level=3, not inlined 22 / 27 27 / 35 25 / 30
opt-level=0 (debug), not inlined 44 / 49 39 / 46 42 / 47

Not inlined, a [u64; 3] or [u64; 2] argument travels by pointer. Inlined, both forms compile to identical code, so the #[inline] on the wrappers is what makes the array form free in a release build, and a change that removes it is a code-size and speed regression. The release profile sets no LTO. script/board-image packs debug programs, and user_mode_runtime builds there at opt-level=0. Even with the wrappers forced #[inline(always)], the aarch64 debug caller grows from 178 to 188 instructions and from a 624-byte to a 672-byte frame, a cost a debug image pays for the rule.

The count (before the rule)

All counts are of lowercase identifiers with an underscore-separated segment from w0..w5 or r0..r5 (w1, carries_w1, r0_after, _w1), on main at 830de0623, excluding vendor/:

P='(?<![A-Za-z0-9_.])(?:[a-z0-9]+_)*_?(?:[wr][0-5])(?:_[a-z0-9]+)*(?![A-Za-z0-9_])'
git grep -I -o -P "$P" 830de0623 -- ':!vendor' ':!bench' ':!*.s' ':!*.S' ':!*.svg' | wc -l   # 2245
git grep -I -l -P "$P" 830de0623 -- ':!vendor' ':!bench' ':!*.s' ':!*.S' ':!*.svg' | wc -l   # 257

A heuristic classifier, posted on the pull request, made the split; a row may be off by a few uses. It counts the excluded paths as foreign, so its rows add up to more than 2245.

Kind Uses Files
Use of a local or a parameter 963 142
Local binding (let, a pattern, a closure parameter) 467 120
Parameter of a private function 63 29
Parameter of a pub fn (public API) 55 16
Field in a struct literal or a pattern 32 14
pub struct field (public API) 6 2
Private struct field 2 2
Code identifiers, all 1588 148
Rust doc comments 310 58
Markdown prose 202 58
Markdown code blocks 60 11
String literals (assertion and panic text) 30 11
Doc prose, all 602 131
Falsification patches and a metrics file, which quote the code above 47 16
Foreign: aarch64 assembly, disassembly in notes, bench logs, SVG namespace URLs 108 9

What (g) does to the declarations

A second classifier, posted on the pull request, sorted the Rust declaration sites. It counts a tuple pattern as one group however many names it binds (let (r0, _) = call(..)), and drops 8 bindings that hold no word (let r2 = memory_region::create(8) is a region).

Declaration Sites Names Under (g)
Function taking several words 30 65 an array, or a result tuple
Tuple pattern 161 300 an array or tuple pattern by meaning
Struct field 6 in 2 files 6 a words array beside fields by meaning
Function taking one word 52 52 word, or a name by meaning
Binding of one word 70 70 a name by meaning

The first three rows hold a group: 197 sites. The last two, 122 sites, never held one. Under (a) all 319 carry a digit; under (g) none needs a positional name, because a word with no meaning yet stays inside its array.

Refused options

The follow-on: a check that refuses spelled numbers and ordinals

The ruling says the tree must not permit these spellings, so the naming check gains a rule. Three further rulings of 2026-11-22 set its scope: the check refuses positions and instances, and allows range boundaries and quantities.

Measured on Rust code outside vendor/, comments and strings blanked, on main at 08d17a3b0, by a script posted on the pull request:

Hit Names Uses
A segment is a spelled number 708 1231
... and it ends the name 132 378
An ordinal past first, per_second excepted 109 177
first_ or last_ before a position noun 8 43
first or last otherwise, allowed as a boundary 283 993
second after per (NANOSECONDS_PER_SECOND), allowed 7 113

Prior art

I read each source below for this decision.

Where nife differs: seL4, Linux and Redox index the words but keep single-letter or numbered names at the register edge. Under (g), nife's position appears only as an index, never as a name.

A concrete example

filesystem_contract's MKDIR today:

/// ... `w1` is the requested [`super::directory`] mask, or ...
/// Reply `r0` = the new directory handle, or an error.
pub const fn destination_handle(w1: u64) -> u64 { ... }

Under (g):

/// ... `words[1]` is the requested [`super::directory`] mask, or ...
/// The reply's `results[0]` is the new directory handle, or an error.
pub const fn destination_handle(word: u64) -> u64 { ... }

and at the server: let destination = fs::destination_handle(message.words[1]);. Under (a) the parameter is word_1 and the reply's word is result_word_0.

Effort

The 197 group sites change shape, and every caller of send, call and receive changes. The typed first word reaches 113 let (..) = call( bindings and 112 reply( calls in 43 files. The single-word sites need names by meaning, chosen one at a time. byte_sink_contract changes first in its own repository and nife bumps its pin, and the lane regenerates and replays the 16 falsification patches. The Kani harnesses and mutation baselines name functions, not parameters; the lane checks that. One lane, in commits by area, after the in-flight renames of the same files land. The naming check's instance sweep is a second lane: 109 names (177 uses), and a reading of the 283 first and last names. The implementation sweep is the proposed milestone design/roadmap/proposals/message-words-are-arrays.md.

How reversible it is

A two-way door today. nife has published no crate, and nothing outside the tree reads these names. The public fields (Message::w0 and the rest, Verb::carries_w1, MessageWords::word_zero) and the shapes of send and call become one-way at each crate's first release. The wire format does not change.

What waits on this