On Nov 13, 00:20, Notan <
notan.k...@gmail.com> wrote:
> Octalnotation makes 010 different from 10 which can be very hard for
> beginners, and even more experienced users. I know that this is the
> way it is in C, C++ and some other derived languages as well.
> It took me days to spot an error like
> ...
> 2039,
> 4556,
> 0145,
> 4453
> ...
> in a generated constant list.
I vote for this too. Real need of octal constants seems disappeared
with end of PDP-11 line. Now they give only confusing and weird bugs
which are quite hard to diagnose. I understand authors copied C style
but it's proper time to remove such legacy while it's possible.
> A notation of 0o10 would be much clearer and more consistent with 0x10
> for hex. One may write 0O10 if obfuscation is the goal.
> By the way 0b010 for binary would be handy sometimes. (An optional 0d
> for decimal makes the whole thing round).
Well, this is well-known syntax (used e.g. in Python); but also there
are another approaches:
Erlang - p#n (p - base, n - number), so 8#10 as octal "10" = decimal
"8"
Ada - #p#n
Scheme - #on (not checked by me), e.g. #o10
I would support any of them but not the horrible mush with leading
'0' ;(
Note this is also discussed in bug#42.