[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: package proposal
- From: Diego Nehab <diego@...>
- Date: Thu, 6 Jan 2005 13:56:14 -0500 (EST)
> Does one really want the exported namespace for a module to inherit the
I believe the original idea was to have globals defined after the call
to module("foo") fall in the namespace for "foo" instead of in _G. This
is something I really like and I would fight to keep. :)
As colateral damage, once module("foo") replaces the environment of the
caller, no globals are visible anymore. To remedy this, the __index
metamethod of the namespace itself was made to point to the original _G.
Since you can capture all needed globals before calling module("foo"),
perhaps this fix should be removed altogether. I prefer the complete
removal to a more complex solution (Lua philosophy...).
We can also leave it as it is because one can remove the __index
metamethod from the namespace after calling module("foo").