On Sat, 5 Dec 1998, Mark S. Miller wrote:
> At 08:58 AM 12/5/98 , Douglas Crockford wrote:
> >If you do allow 0x- for hex, please do not allow 0- for octal. I think
> >having a leading zero silently change the radix is a dangerous thing in a
> >scripting language.
>
> [+] A good and deciding point.
> I can't accept 0x- and not 0-, and I can't accept 0- without treating it as
> octal. However, as you point out, to the C-naive, it's surprising for
> leading zeros to change the radix, therefore I have to reject 0-.
> Therefore I have to reject 0x-. So the resolution is the original
> proposal: Smalltalk's <radix>r<digits>, combined with informative errors
> when they try it the C way. Thanks.
[-] The 0- and 0x- convention is too universal to ignore. Yes, it's true that octal conversion can be a little surprising, but that's something you can get bitten by only once in your entire life. If you have learned almost any language before E -- as we expect most people have (coming from Java, C++, Python, Perl) you already know this convention.
> Is this readability difference worth it? Is there a better choice than
> "_"? Should numbers print this way too? Opinions solicited. Thanks.
[#] Perl accepts numbers containing underscores; Tcl and Python do not. I am indifferent on this issue since i never use underscores in numbers, and this convention is neither useful nor surprising for me. Certainly, if you do allow it, do not use any other character than the underscore.
[-] Numbers should not print with underscores. I know of no language and no printing function that ever does this. If people must break up long numbers they can do it in some other way with commas.
!ping