3. Newlines terminate statements
- Status: Accepted
- Date: 2026-09-02
Context
A language needs to know where one statement ends and the next begins. The
options are an explicit terminator (;), an explicit separator only when
statements share a line, or newline-as-terminator with rules for continuation.
Semicolons at end of line are pure ceremony in a language that also uses indentation: the newline is already there and already meaningful.
Decision
A newline ends a statement. There is no statement terminator or separator character, and no way to put two statements on one line — that is the "one obvious way" choice; a line is a statement.
A statement may span multiple physical lines only when the break is unambiguous:
- inside unclosed
(,[, or{— the lexer suppressesNEWLINEwhile any bracket is open; - immediately after a binary operator or a comma (the line is syntactically incomplete).
There is no line-continuation character (\).
Consequences
- No
;, no "missing semicolon" errors, no ASI-style hazards from inserting one incorrectly. - Long expressions are wrapped by opening a bracket, which is a mild constraint and a common style anyway.
- The lexer must track bracket depth to decide whether a newline is significant. This lives next to the indentation logic (see 0007).
- No
a = 1; b = 2on one line. Deliberate.
Alternatives considered
- Optional trailing
;(JavaScript, Swift). Creates two ways to write every line and an ASI rule that has to be learned. ;as a separator for multiple statements per line (Python). Adds a feature whose main use is writing code that is harder to read.- Explicit
\continuation. More syntax for something brackets already handle.