From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q18DdRFV028732 for ; Wed, 8 Feb 2012 14:39:28 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvoCAER6Mk/AbSoIe2dsb2JhbABDhQ2qXSIBARYmBCOBcgEBBAEjVhALCQUKAgImAgIUGDEph2YDBqdGkgYTgRyKIgICHQQGAS4ED4QVDQUEIIIkM2MEjWKHSpJf X-IronPort-AV: E=Sophos;i="4.73,383,1325458800"; d="scan'208";a="143394929" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Feb 2012 14:39:27 +0100 X-Envelope-From: oliver@first.in-berlin.de Received: from first (e178010107.adsl.alicedsl.de [85.178.10.107]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id q18DdQ56012819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 8 Feb 2012 14:39:26 +0100 Received: by first (Postfix, from userid 1000) id 28B4D154022C; Wed, 8 Feb 2012 14:39:26 +0100 (CET) Date: Wed, 8 Feb 2012 14:39:26 +0100 From: oliver To: David House Cc: Gabriel Scherer , Matej =?utf-8?B?S2/FocOtaw==?= <5764c029b688c1c0d24a2e97cd764f@gmail.com>, caml-list@inria.fr Message-ID: <20120208133926.GC1823@siouxsie> References: <4F326EA6.20900@gmail.com> <4F32741C.4040501@janestreet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4F32741C.4040501@janestreet.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 Subject: Re: [Caml-list] syntactic detail On Wed, Feb 08, 2012 at 01:09:48PM +0000, David House wrote: > 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 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. For rare cases it might also make sense to have "_" inserted arbitrarily, for example in math education or when clarifiying things to others, it might also make sense to put "_" around the differing values. So it migth make sense for clarifiying differences and for educational purposes. For example you might have a startvalue of an algorithm and the staring value for a certin behaviour is 3.36639926549992 but your colleague uses 3.36639296549992 For clarification one could write: 3.36639926549992 vs. 3.36639296549992 or better 3.36639_92_6549992 vs. 3.36639_29_6549992 A case, where two digits were switched. 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. Why should this case be forbidden? > > 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. Ciao, Oliver