removal of cruft from D
Don
nospam at nospam.com
Fri Nov 20 21:47:58 PST 2009
Leandro Lucarella wrote:
> Bill Baxter, el 20 de noviembre a las 15:43 me escribiste:
>>> octal(755)?
>>>
>>> What's the base-10 identity of that?
>>>
>>> decimal(493) or decimal(755)?
>>>
>>> base-16 etc.
>> Fine. Make it octal!"755" if you prefer.
>> The point is just that you can write a function that will convert a
>> number to octal for the rare cases when you need it.
>> You don't absolutely need octal literals.
>
> Please, understand this: IS NOT RARE IF YOU DO POSIX SYSTEM PROGRAMMING.
>
> If you remove octals because they can be implemented in the library,
> remove hexa and binary literals as well. And please, stop using the
> argument of octal literal being rare, they aren't when programming using
> POSIX. You use the all over it when managing filesystem related stuff.
That's quite a false dichotomy! Octal literals are used for POSIX file
systems calls, and pretty much nowhere else (These days, they're a
PDP-11 relic, really, once hex was invented octal became obsolete). For
example, I don't think arithmetic is ever done on octal values.
I don't believe octal!("317"); is so terrible -- it's still much shorter
than the equivalent code on Windows! Especially considering that they
should never appear in OS-independent code.
But it's a matter of little consequence. The problem really is that
octal has this preferred status, 0123 looks far too normal for something
which is so obscure.
> I do think octal literals should be 0oNNN (or 0cNNN, I prefer 0oNNN
> because it's already used by Python, so I would be very error prone to me
> when switching the language to remember which to use).
More information about the Digitalmars-d
mailing list