Re: Underscores in numbers for legibility Peter Bex 12 Apr 2019 20:08 UTC
On Fri, Apr 12, 2019 at 11:00:54PM +0300, Lassi Kortela wrote: > > Same here for CHICKEN, but I'm a bit hesitant to go in and complicate > > the numerical syntax of Scheme. We just got rid of the ridiculous hash > > syntax (which _really_ complicated Scheme numerical syntax)! > > I'm sympathetic to that - simplicity is good. I was thinking it would be > best to only allow it between digits, and deny it at the beginning or end of > a token. And perhaps also to disallow more than one consecutive underscore. > So like this: > > 1_000_000 ; good > 1_000_000_ ; bad > _1_000_000 ; bad > _10000000 ; bad > 10000000_ ; bad > 1__000_000 ; maybe bad > > If underscores are allowed at the beginning of a token, then there is more > possibility of conflict -- e.g. in C you can write a function named '_123'. I also think this will definitely break backwards compatibility for non-base prefixed numbers. That's actually worse than the complexity (which is managable). Cheers, Peter