lua-users home
lua-l archive

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


On Sat, Jan 9, 2010 at 11:23 AM, Matthew Wild wrote:
> But require() should be the one that sets the global (if it must) and
> return the module (I prefer this) into the caller's environment.

I had come to the same conclusion: The policy of how a module is
imported should be caller's decision (require), not hard-coded into
the module definition (module).  Granted, it has been said that the
caller can redefine "module" prior to doing "require" and therefore
adjust policy, but this seems messier to me and I don't know within
what limits the caller should be constrained in doing this without
breaking any contracts in the module.

[1] http://lua-users.org/lists/lua-l/2009-09/msg00394.html
[2] http://lua-users.org/lists/lua-l/2009-09/msg00438.html
[3] http://lua-users.org/lists/lua-l/2009-08/msg00297.html