lua-users home
lua-l archive

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

On Mon, Nov 18, 2013 at 4:40 PM, Philipp Janda <> wrote:
> Am 18.11.2013 22:47 schröbte Tim Hill:
>> (top-posting as general comment…)
>> Isn’t this really a circular discussion? It seems to me there are two
>> reasons for assigned a function in a table to a local:
>> — Brevity (easier to type “foo” than “some table.somefunction”)
>> — Performance (access to locals is faster than access to globals or table
>> values with string keys)
> + Making a module immune to changes in the global environment
> + Providing easy access to globals when you intend to replace `_ENV` (or use
> `module`/`setfenv`)
> + Documenting a module's/file's dependencies
> + Asserting that the module's/file's dependencies are there at load time

These all can be done with _ENV; local isn't necessary for them.

/s/ Adam