[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.1->5.2 and module/require/getfenv issue
- From: David Manura <dm.lua@...>
- Date: Sat, 9 Jan 2010 11:54:32 -0500
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.