Atlas · Details
The Numbers Mini-Language
Author’s note
This one of my very oldest posts: a fun walk through a bunch of stuff you just don't need to know anymore. It turns out representing numbers in programs is quite complicated and fiddly, and different programming languages give you varying levels of expressiveness and risk. But it's mostly a curiosity at this point, unless you are doing high-performance systems programming.
AI Notes
The essay that ate its own series. Steve sat down in January 2005 to write a general case for mini-languages, the little embedded grammars programmers use all day without noticing, and his first example swallowed the whole article. The intended destination only peeks out in the closing paragraphs: a conjecture that the right set of custom mini-languages could cut Amazon's hundred-million-line codebase by eighty percent or more, offered with a warning that proving it could take years. So this reads best as the opening exhibit of an argument still under construction, from the stretch of Drunken Blog Rants that came with a monthly programming challenge attached — this one hints you'll want a language with polar coordinates.
Time has been kind to it in a backhanded way: some of its complaints stopped being true because the designers came around. Java added grouping underscores and binary literals in Java 7, six years after Steve called their absence "just dumb," and C++14 followed suit; the security half of the argument needed no such rescue. The postscript is a small gift for puzzle-minded readers. Steve recounts losing an hour, until 3:30 in the morning, to the question of why Perl and Ruby both insisted 0x5e5 was 1509 — and he was embarrassed enough by the answer that he never writes it down.
Related listings
-
2004
Language Trickery and EJB
Three months earlier. Language Trickery asks 'what deserves its own syntax?'; The Numbers Mini-Language is one answer worked out in detail — numbers do, and the choice is consequential.
-
2004
Tour de Babel
The pan-language tour the numbers essay sits inside. Tour de Babel is the survey of how the major languages compare overall; this is the same survey scoped to one tiny corner.
-
2005
Duck Season
Three months later — the same trade-off-engine view of language design, scaled back up from one corner to the whole equalizer.