lua-users home
lua-l archive

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



> > > Why they must be const?
> >
> >   I think it's to prevent the value from being lost and thus, not closed.
>
> Do we need this "protection"?
> Which adversary we should be protected from?

  Typos, mistakes, stuff like that I guess.


We have much bigger problem in Lua: every typo in a local variable's name silently converts it to global.
Compared with this, a "const" looks like a useless toy (if we consider "const" as a protection against typos).
IMO, "to-be-closed variable accidental assignment alert" should be moved from Lua core into external software (such as luacheck)
Besides, it would be useful to have non-constant to-be-closed variables