On 02/08/2012 12:54 PM, Gabriel Scherer wrote:
There is no purpose, it's just an edge case of the simple lexical
specification you can find at:
http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#float-literal
Everywhere digits are allowed, you can insert extraneous underscores.
There is no restriction that there must be at least one digit for
underscores to be valid. I don't see why there should be.
I would actually prefer a slightly more constrained format. It is very
easy to typo large numbers like:
let ten_million = 10_000_0000 in
When eyeballing this, it is extremely easy to mistake this as 10^7, when
it actual fact it is 10^8.
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.
--
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