lua-users home
lua-l archive

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

Isn't this the general pattern in Lua to always create a new variable and shadow any existing one with the same name, without telling anything to the user ?

That's why in LJS ( I made it a warning/error.

The fact that Lua 5.4 now has <const> make the shadowing problem more evident in the example given.

On 17/6/21 15:35, Roberto Ierusalimschy wrote:
Hi, I've discovered that the function definition syntax (function
name(args) body end) doesn't check if the variable assigned to is

local x<const>
function x(...)return print(...)end
x"???" --> ???

I feel like this should generate an error, but maybe there is a reason
for this being allowed?
This is a bug. Thanks for the report.

-- Roberto