lua-users home
lua-l archive

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

Tomas Guisasola wrote:
> On Thu, 26 Apr 2007, Thomas Lauer wrote:
>> I can't see how the current module system would cleanly refer to more
>> than one parameter, given that module()'s list of optional parameters
>> (after the name) is a list of functions to be applied over the
>> module. 
> 	Yes, code like `module(...)' will not work if required with more
> than one argument (supposing `require' will pass them to the module). 

There's another issue with multiple parameters to require. Require
parameter got passed not only to the module itself, but also to the
module loader which loads the module. It would be nice to pass optionnal
parameters to the module loader. For example imagine you have a loader
that will retrieve modules from an online module repository (through
http), it would be nice to pass the url of the server as the require
second argument. From my point of view that would be much more useful to
parameterize the loaders than the module themselves.

So how would you determine which arguments of require goes to the
loader, and which goes to the module ? With the fact that many modules
beginning with module(...) instead of module((...)) will fail to work if
the module chunk get more parameter, I think it's clear that adding more
parameters to require needs at least a partial rethink of the module
system before it becomes a standard.

On the other hand, for a given application, you can easily and safely
modify require, module and the loaders to manage these extra arguments.
But you won't be able to use third-party modules.