The semicolon; a short history

The semicolon; a short history

●1 ●8
calendar_today ago • schedule1 min read
— Originally published at tommy-bergstrand.se

Almost every line of C you've ever written ends with a semicolon. But the mark is more than 500 years older than C: it was invented by a Venetian printer, Aldus Manutius, and first appeared in print in Pietro Bembo's De Aetna in 1496, as a pause longer than a comma and shorter than a colon.

I wrote a longer piece about how it got from Renaissance typography into our compilers, and what different languages do with it today:

  • Separator or terminator? ALGOL and Pascal put it between statements, C puts it after them, and that's why Pascal rejects a ; before else.
  • Line ending or not: Python treats the newline as the terminator, Kotlin and Swift make it optional, and JavaScript inserts it for you, sometimes where you didn't want it.
  • Rust, where one semicolon changes the type of a function:
fn five() -> i32 {
    5        // returns 5
}

fn broken() -> i32 {
    5;       // error: expected i32, found ()
}
  • Go, which was released in 2009 with semicolons. A month later Rob Pike proposed on golang-nuts to let the lexer insert them instead, borrowing a trick from BCPL. That's why your opening brace in Go has to stay on the same line:
if x > 0      // the lexer inserts a ; here...
{             // ...so this is a syntax error

There's also the Greek question mark (U+037E), which looks identical to ; and makes a lovely prank in a colleague's C# file.

Read the full post, with history, code examples and the Go story: The semicolon; a short history

Want more #rust & #go deep dives?

Join 6,095+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

The Languages of Machines and Humans: A Developer's Perspective

nevmenandr - Nov 4

Short links that outlive the vendor: a newsroom URL shortener on WordPress and AWS

jaafarabazid - Nov 10

Data Types Across Programming Languages: What You Actually Need to Know

Ken W. Algerverified - Oct 6

Legacy in the Data: Transforming Family Medical History into a Blueprint for Longevity

Huifer - Jan 29

The Zero-Net-Loss Fleet & The Mercenary Squad: A Live AI Economy

DEVPlank - Aug 4
chevron_left
178 Points • 9 Badges
Gothenburg, Sweden • tommy-bergstrand.se
3Posts
0Comments
2Connections
Agentic coder with an ERP background.

Commenters (This Week)

16 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!