lua-users home
lua-l archive

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


> 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.