On Wed 08 Feb 2012 01:39:26 PM GMT, oliver wrote:
I think the problem of being confounding 10_000_0000 with 100_000_000
or 10_000_0000 with 10_000_000 is less prominent then confounding
100000000 with 10000000.
So this syntax rule already makes things much easier to read.
That's it's advantage.
To have here all three characters as syntax rule could make sense,
but is less a problem than having no allowance of "_" in numbers at all.
That is definitely true.
Might not be the case that pops up all to often,
but if so, it might be fine, if both values can be used:
let startval_correct = 3.36639_92_6549992
let startval_wrong = 3.36639_29_6549992
So I have invented reasons why it's fine as it is.
Perhaps this could happen. But I feel this could be expressed equally
clearly using some other mechanism, like a comment. We don't have to
have syntax-level support for every weird thing people would like to do.
Why should this case be forbidden?
Because it is impossible to distinguish it from the wrongly-deliminated
case that I described, which leads to the bugs I described.
Your example actually raises another point -- I'm not sure how my ideas
would be extended to bits after the decimal place in floating point
literals. Doing something like "every third character going right from
the point" would probably be sufficient.
I would prefer a syntax rule that only allows underscore every three
characters (starting at the RHS of the number, i.e. complying to the
usual convention). Well, certainly that for decimal literals. For
hex literals you probably want to enforce the same, but every four
characters.
[...]
For Hex it might also make sense to have it all two characters.
If the rule would be only all 4 characters, that would be bad.
Sure, this seems okay.
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs