[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.1->5.2 and module/require/getfenv issue
- From: Cosmin Apreutesei <cosmin.apreutesei@...>
- Date: Sun, 10 Jan 2010 16:34:23 +0200
> Pragma modules are a special case where the policy on side-effects
> cannot be entirely delegated to the client (though it may be partly
> delegated via e.g. "additional_arguments" above).
Problem with additional_arguments is that once you have 2 ways of
require()'ing a module, you cannot have the module cached
automatically by require() anymore. You can solve this by complicating
require() to search for a function in the module namespace and, if
found, call it with additional_arguments and return its result instead
of package.loaded[modulename]. That is, if the module returns a table,
but that's even more policy upon the poor module.