On Wed, Jul 4, 2018 at 8:41 AM, Daurnimator wrote:
We already have an opt-in of this behaviour:
local _G = _G; local _ENV = nil
and then use e.g. `_G.print
On Wed, Jul 4, 2018 at 1:25 PM, Dirk Laurie wrote:
local next, io, print = next, io, print
-- etc: first cache all the globals you need
local _ENV = setmetatable({},{__index=error, __newindex=error})
These are two more "yet another run-time alarmers".
They are not equivalent to my suggestion.
Any "runtime-alarmer" is unable to find all local variable name typos (for example, inside currently inactive "if" branch).
...
All existing solutions are actually run-time checkers, they are unable to solve the problem.
And simultaneously I want to solve another problem "globals are accidentally shaded out by locals with the same name".