Is the world coming to an end?
Adam D. Ruppe
destructionator at gmail.com
Sun Apr 3 08:58:38 PDT 2011
spir wrote:
> What I fail to see is the advantage of introducing an exception for
> octal.
Octal isn't the exception. Of all the infinite number bases out there,
octal is the one done in the most generic way. (In fact, it'd
probably be a reasonably simple change to make it alias base!8 octal;
or something like that)
The exceptions are decimal, hex, and binary. Each one has reasoning:
decimal: that's the way we normally talk and think. We need a
starting point somewhere, so this is the natural choice.
hex: commonly used and cannot be easily written as a decimal
literal. Piles upon piles of existing code depend on it.
binary: Incredibly useful, not easily written as a decimal. The
case for giving it special treatment isn't as strong as
hex, but it follows the same reasoning. (Actually, in
code that I write freshly, I use binary literals more
often than hex. Like Walter, my brain is slow at making
masks out of hex.)
Anything can follow the same pattern as octal. Not anything can
be shoved into the language.
More information about the Digitalmars-d
mailing list