Re: Underscores in numbers for legibility
Lassi Kortela 13 Apr 2019 07:27 UTC
> While the common in-use cases are ..., +, and - , R7RS permits lots of symbols starting with decimal point or sign. See <peculiar identifier>.
>
> ...and underscore is part of <special initial> which makes it part of <dot subsequent> and <sign subsequent> too.
>
> While adding a bunch of tests just now, I came across the fact that reading "._75" has to produce a symbol and not the inexact number 0.75, but ".7_5" is okay.
> Incidentally, MIT Scheme has allowed 1+ (for the increment-by-one procedure) and -1+ (for the decrement-by-one procedure) for forever.
> So yes. numbers can't have leading underscores, and 1+ and -1+ are
> implementation-specific additions to the <peculiar identifier> list.
Very good points all.
Let us take peculiar identifiers and implementation-specific additions
into account and assume the most conservative proposal (an underscore
can only appear between two digits -- no leading, trailing or duplicated
underscores). Do you feel that the proposal is still reasonable or have
we blown our complexity budget?
I'm starting to realize why Common Lisp reserving "potential numbers"
from the get-go was a wise move. (Though they specified it so that
potential numbers parse as symbols in implementations which can't handle
them, which may not have been as wise.)