lua-users home
lua-l archive

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

"Hisham" <> wrote:
> With the module() + package.seebase variation suggested at [1] I think
> the only remaining drawback would be that all accesses to globals go
> all the time through function calls when using package.seebase.

Can we just do this instead for seebase?

function package.seebase(mod)
   local env = {}
        { __index = setmetatable(mod, {__index = lua_libs}),
          __newindex = mod })
    return env

More indirection, but no function call. Since we're already copying
package.loaded._G can we just lazily cache those in the mod table too?


Other people have been complaining about the module discussion on the
list recently, but I think it has been productive too.

I think we may be close to a solution that will have broad approval.

James Graves