- Is on the Line of What It Subtracts From — a - That Begins a Line Begins What Is Written ThereNote (#1600, 2026-11-15):
crates/nikaia-std/src/tools/has moved tocrates/nikaia-std/src/compiler/(its generated Rust tocompiler/lowered/). The text below keeps the old path; the Rust module is stillnikaia_std::tools.
Status: Accepted
Date: November 5, 2026 (supervisor’s decision, by the language principles)
Answers: #1247
Related: ADR-135 D3 (a [ at the start of a line begins a
literal); ADR-317 (the same rule for a call’s ();
ADR-grammar-syntax-v1 D17 (same_line); Part I 3.1 (a statement begins a line)
The grammar reads no newlines in an expression, so a line that begins with
- was read as a subtraction from whatever the line before it ended with:
let n = run() catch {
println("x")
-1
}
was println("x") - 1: the block’s value became a subtraction from (), and
rustc refused it. Nothing in the program looks like a subtraction. - is
the one operator that is both binary and prefix; ! is prefix only, and +,
*, &&, || and the comparisons cannot begin an expression, so a line that
begins with one of them has only one reading.
; at a newline after a name, a literal or a ), so a
-1 on the next line is a statement of its own. Kotlin ends the
statement at the newline in the same position.- by the whitespace around it: - x is binary, -x
with a space before and none after is prefix.| Option | For | Against |
|---|---|---|
A. A subtraction’s - on the line of its left operand (Go, Kotlin) |
The rule [ (ADR-135 D3) and ( (ADR-317) already have, read the same way; nothing new to learn |
A long subtraction broken before its - is written with the - at the end of the line instead |
B. Read - by the space after it (Swift) |
Keeps a leading - x as a continuation |
A second rule, and one space changes what a line means |
| C. Keep the subtraction, warn (JavaScript linters) | Nothing that parses today changes meaning | A warning for a line that says exactly what it means |
Option A.
- is written on the line of what it subtracts from.A - that is the first thing on its line is not a subtraction’s: it begins
whatever is written there, a negative number or a negation. A subtraction
broken over lines keeps its - at the end of the line it continues.
[ and (, and read the same way.The parser asks whether the - begins a line, from the whitespace it skipped
(same_line, ADR-grammar-syntax-v1 D17); nothing is inserted and nothing is looked ahead for.
An operator that cannot begin an expression (+, *, &&, ||, ==, !=,
.., ?., .) still continues the line above when it begins a line.
-1 after a call has the value -1, which is
what it looks like.-
(crates/nikaia-std/src/tools/project_check.nika) is rewritten with its
- at the ends of the lines.