[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: modules, require, magic
- From: Matthew Wild <mwild1@...>
- Date: Wed, 19 Oct 2011 21:37:19 +0100
On 19 October 2011 21:24, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> Certainly an improvement from handling the module table explicitly
>> (and no segfaults this time). But having basically the same function
>> being provided by the loader[1] would obviate the need for explicitly
>> mentioning _ENV.
>
> I think explicitly mentioning _ENV is good. If you are working with
> a different global environment, why hide that information? Moreover,
> a modified 'load' function forces everyone to live with its magic.
>
Agreed. Also if someone doesn't want to change the environment, but
just use the other features of module() they can simply
local mymodule = module("mymodule")
function mymodule.myfunction()
end
You can even name this table 'exports', for those missing Node.js :)
Regards,
Matthew
- References:
- modules, require, magic, Eduardo Ochs
- Re: modules, require, magic, Javier Guerra Giraldez
- Re: modules, require, magic, Petite Abeille
- Re: modules, require, magic, Sam Roberts
- Re: modules, require, magic, David Manura
- Re: modules, require, magic, Hisham
- Re: modules, require, magic, Roberto Ierusalimschy
- Re: modules, require, magic, Fabio Mascarenhas
- Re: modules, require, magic, Roberto Ierusalimschy
- Re: modules, require, magic, Hisham
- Re: modules, require, magic, Roberto Ierusalimschy