lua-users home
lua-l archive

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


> With the proposed _ENV environment design for 5.2 that would
> reassign setfenv/getfenv to the debug library, would it also make
> sense to change the design of module() to return the table to use as
> the environment, rather than actually having it change the
> environment? This way, you could replicate the old use of module
> with the only slightly different statement "_ENV = module(...)"
> without having to "bend the rules" of the language [...]

That is the whole idea. (For compatibility, "module" will still change
the _ENV of the calling function, but you can turn this off with a
compile option.)

BTW, note that setfenv/getfenv are not moving to the debug library, but
out of the language, as functions will not have environments anymore.

-- Roberto