lua-users home
lua-l archive

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


	Hi Jerome

> 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.
	Maybe I am not following your thoughts but I think that this
special loader might be configured to work properly in a particular
environment and this should not be the case of the programmer that is
trying to load a module.  Don't you agree?

> 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.
	Sure, but I think this discussion could help :-)

> 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.
	In this case it is not a simple task, because you will
have to rewrite `require' -- which is not a simple function --
to change only the call of the module function!

	Regards,
		Tomás