lua-users home
lua-l archive

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


On Tue, Dec 18, 2018 at 12:34 AM Sam Pagenkopf <ssaammp@gmail.com> wrote:
>
> 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.

The workaround has already been explicitly shot down in this thread:
it's a runtime transformation which means you take a performance hit
every time you use one. It HAS to be done at the lexer level to be
practical for anything that needs to worry about scalability. This
plus binary literals are things that have been in demand for quite a
while and they're things I think are worth doing -- though they're
things that can be done with token filters, too.

Inline long comments with --[[ ]] work fine for comments. The proposal
was actually trying to ask for an annotation syntax and just did a
poor job getting the point across. That's why other posters have
talked about syntaxes like @annotation(param, param) as something that
could be parsed cleanly but be a no-op in the interpreter so that
other tools can use the markup to do other tasks. Inline comments do
WORK for this, but they're a little bit on the verbose side and people
would like something with a bit better integration. That said, while I
understand the desire and intent, I don't particularly have a strong
opinion about it myself.

/s/ Adam