lua-users home
lua-l archive

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


On 15/07/2019 14.50, nobody wrote:
If `module` is allowed to use some debug magic internally, it could set the loading file's newest _ENV variable and then you'd have the good old

  module( ... )

with no user-facing mention of _ENV at all. (Only that you can't accidentally set globals anymore, you'll have to explicitly prefix with _G now.)

(Or rather, you'd neither have everything be visible through the module
table (as with `package.seeall`) nor need to explicitly pre-`local` all
the stuff that you need to access. The old `module` already prevented accidental globals, it just didn't create an environment (only a module table) and made things public-by-default, so you'd still accidentally pollute your module if you forgot to `local`.)

-- nobody