Number literals (Was: Re: Case Range Statement ..)

Derek Parnell derek at psych.ward
Tue Jul 7 22:01:06 PDT 2009


On Tue, 07 Jul 2009 20:20:28 -0700, Walter Bright wrote:

>> Or just drop octal altogether.  Outside of chmod, when is there any
>> legitimate need for it these days?
> 
> Translating C code to D.

On Tue, 07 Jul 2009 20:29:40 -0700, Walter Bright wrote:

> Sometimes I run across someone else's code that does:
> 
>     for (i = 0; i <= 10; i++)
>     {
> 	... array[i] ...
>     }
> 
> and I'll always rewrite it as i<11, because the former confuses my brain 
> into creating bugs.

On Tue, 07 Jul 2009 21:06:11 -0700, Walter Bright wrote:

> I've translated code, and a tool isn't really necessary. But translating 
> octal constants to hex like 077733 is very error prone. And yes, I ran 
> into a bunch of them just recently in the OSX system header files. So 
> they exist. I don't see a good reason to make things difficult to translate.

So ...
Octal literals are so common that we need compiler/language support.
Character ranges are so rare that we do not need compiler/language support.
Compatibility with C is paramount, except when it's not.
Technical merit trumps human interface.

I think that I'm not ready for the D programming language after all. I'll
drop by the sandbox from time to time out of curiosity, I suppose. Good
luck and thanks for all the fish.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list