lua-users home
lua-l archive

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


On 15/09/2018 02:00, Sean Conner wrote:
It was thus said that the Great Jim once stated:
i would add support for binary and octal integer literals like
0b1001011 or 0o0755 as in Python and Ruby.

octal integer literals are helpful when working with unix (file)
modes/permissions (which i do frequently).

  I would not object to this, but what I would like to add is '_' to literal
numbers to aid in comprehension.  Some examples:

Yep! This is really something I miss among low-level stuff.

I implemented (repeatedly :-) some functions that handle that, together with handling binary numbers (answering to Roberto here), but I find them too "hackish", i.e. they work well for my codebase, but other people may use their own variation and interoperability becomes a nightmare.

I think something so basic should be in the bare language. Probably it doesn't even add much weight to the parser. (Not a problem for me now - I'm just wearing my old and dusty professional dev hat :-)




	x = 4_294_967_295
	y = 0xABCD_1234
	z = 0b_110_1_0010_1010_01_11

  -spc



Cheers!

-- Lorenzo