lua-users home
lua-l archive

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


I think inline backtick comments are unneeded, --[[inline comment]] is good enough.

Never saw a problem with _G.THING for explicit globals, someone let me know if I'm wrong.

For long literals, there's a workaround:
function num (n, base) return tonumber(n:gsub('_', ''), base or 10) end
assert(num '100_000' == 100000)
And don't forget the 4e10 syntax for literals with lots of zeroes.
assert(1e5 == 100000)

And if you really hate names like setmetatable and collectgarbage, just rename them locally.

On Tue, Dec 18, 2018 at 12:08 AM Jim <djvaios@gmail.com> wrote:
On 12/17/18, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> Must it be an ASCII character? Why not Unicode/UTF8, as in 1 000 000?

what a great idea.
using unicode non-ASCII chars in place of ASCII in the core language syntax
in a situation where the latter are fully sufficient and nothing is
gained by doing so
seems in fact pretty silly.

instead using '_' as separator in integer literals (that is ignoring
any occurring
underscores in such literals) is a sound proposal also found in other
languages (java).
this is especially useful for binary literals (which Lua sadly still lacks).