PROPOSAL: Underscores in numbers

Daniel Cheng j16sdiz at gmail.com
Tue Mar 31 01:07:49 PDT 2009


On Tue, Mar 31, 2009 at 3:14 PM, Bruce Chapman
<brucechapman at paradise.net.nz> wrote:
> Derek,
> thanks for writing this up, it saved me doing it. (and it would
> complement my integer literal proposals nicely)
>
> A couple of comments:
>
> 1. I don't really like most of your decimal examples because (apart from
> the money one) although we talk about these as numbers, they are not
> numbers really, just identifiers whose significant elements consist
> solely of digits. As an explanation, prepending 00 to the front of any
> of these would yield a different (or invalid) phone/credit card/SS
> number, whereas prepending 00 to a number does not (but not in java
> where it makes an octal or a compiler error :), similarly add two
> together or subtracting them makes no sense.
>
> Real countable number examples that could be useful are populations,
> national debt, Long.MAX_VALUE etc, as well as the hex and binary
> examples you use later.
>
> I am not convinced of the utility of multiple consecutive underscore
> separators, and I think the example that uses that is confusing and
> asking for trouble.

I am in favour of consecutive underscore
 -- I can use them to align digits over lines and this make parsing a bit easier

> IMHO it would add to the value if you removed that
> option, but you might have some good use case you are thinking about.
> Similarly for underscore at either end seems strange. It might take more
> effort to describe it such that these are illegal, but I don't think
> anyone would complain at the absence of that form.
>
> Any reason why in the syntax you didn't just add underscore to the
> various XXXXDigits forms (and maybe change the name a little) rather
> than the more complex approach, then describe the erasure of the
> underscore in the description of each form?
>
> Bruce



More information about the coin-dev mailing list