lua-users home
lua-l archive

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


On Wed, May 20, 2020 at 9:52 AM pocomane <pocomane_7a@pocomane.com> wrote:

> If you introduce a new keyword "const"

This depends on your definition of "keyword". Keywords can be absolute (which is what you assumed) and they can be contextual. Take this example:

const a = 1

That is not valid in Lua 5.3.

Therefore, Lua 5.4 could introduce a new rule for its parser/lexer: at the beginning of a statement, const followed by another identifier has a special meaning, but it has no meaning otherwise. Then, for example, the following could be valid:

const a = 1
local const = {a = 2}
const.a = a

This does make the translator more complex.

Cheers,
V.