Is the world coming to an end?

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 4 05:50:31 PDT 2011


On Sun, 03 Apr 2011 03:14:31 -0400, Russel Winder <russel at russel.org.uk>  
wrote:

> On Sat, 2011-04-02 at 18:20 -0500, Andrei Alexandrescu wrote:
>> On 4/2/11 5:27 PM, ulrik.mikaelsson at gmail.com wrote:
>> > A D-newbie would probably be able to guess 0o for octal, but hardly
>> > octal!. octal! breaks the rule of least surprise.
>>
>> I fail to infer how using the word "octal" for an octal literal is
>> surprising at all.
>
> The problem is not that it is a poor solution in isolation, it is the
> conflict between 0b... and 0x.. versus octal!...  Why is octal being
> discriminated against compared to binary and hexadecimal?
>

This currently works in D:

auto hexvalue = 0XABCD;
auto binvalue = 0B1011; // BTW, walter, this is 0xB, I always remember it,  
because A is 10, and in binary that's 1010, add 1 for B ;)

So if you have the 0o syntax, wouldn't you need the 0O syntax to be  
'non-discriminatory'?  And if we have that, I think your argument loses  
all credibility.  You can't argue discrimination unless you are arguing  
for the 0O syntax, which is non-defensible.

I agree with everyone who says octal!x is good enough -- nobody uses octal  
except for unix permissions, so anyone who's arguing against the syntax is  
doing it from a theoretical position, since it probably doesn't affect  
them.

-Steve


More information about the Digitalmars-d mailing list