lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 17/12/2018 21:48, Egor Skriptunoff wrote:
On Mon, Dec 17, 2018 at 1:43 PM Lorenzo Donati wrote:

Numeric optional separator: I crave this, together with a standard
syntax for binary literals[1] . C++ addressed both needs with the syntax:

0b1011'1100'0001

I'd prefer the underscore as a separator, though:

0b1011_1100_0001



In Lua syntax a literal number is never followed by a literal string, so
C++ syntax (1'000'000) is suitable for Lua too.
IMO, 1'000'000 looks nicer than 1_000_000.
But probably my opinion is biased because 1'000'000 is one of the standard
ways to write numbers in Russian texts (space is also used as thousands
separator).
BTW, fast googling showed that "upper dot/upper comma" are used as digit
groups separators (at least in handwriting) in some other countries:
Belgium, Italy, Romania, Switzerland, Mexico, Liechtenstein.
In English-speaking countries a comma is used as separator, that's why many
people prefer something bottom-ish (such as underscore).


Although I'm Italian and we traditionally use a small /upper/ (sometimes also lower) dot to separate digits in big number, my bias against single quote as separator is a visual one:

1. it is smallish and may be difficult to see in some fonts (especially when it is proportional - yes I use proportional fonts when programming, switching to monospace rendering when really needed).

2. My "internal parser" interprets the single quote as something "string/char" related, so it interferes with my "mental code processing", slowing me down.

3. The underscore resembles a space, which is what I use as a separator when writing number in text (the traditional Italian way collides with other countries uses, especially English-speaking ones, so a way to avoid ambiguities is using spaces, which is AFAIK unambiguous almost anywhere and coherent with scientific writing).

Point 2 is the worse pain point for me. Of course YMMV.