digit groups

Aaron Denney wnoise at ofb.net
Wed Oct 25 16:57:16 EDT 2006


On 2006-10-25, Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk> wrote:
> No. A small alteration to the lexical syntax for the sake of
> improved readability seems perfectly justifiable as long as
> it doesn't make the lexical syntax /significantly/ more
> complicated or harder to learn.

Sure.  But some of us don't find it terribly readable.  I think the ~~
operator hack gets 90% of the "benefit" for those who want it.

> although my preference would be something a bit more
> restrictive, requiring numbers to have groups of the same
> number of digits after each “_” and beginning with a shorter
> group (ie 12_000_000 and 1200_0000 would be valid but
> 1247_000 would not). I'm not wedded to this requirement (and
> it would take a more sophisticated grammar to formalise).

The only reason to put it in the lexer/parser is to avoid misleading cases,
which needs thas additional restriction, or something similar, like
always 3 for decimal, 4 for hex, 3 for oct, or whatever.

-- 
Aaron Denney
-><-



More information about the Haskell-prime mailing list