lua-users home
lua-l archive

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


Hi,

It does not. There will be an explicit require "a.b" after that require "a".
As Tomas pointed out, a only needs to register in preload its submodules.

By "making a.*" available, I meant setting up the preloads for all
submodules of "a". In case these modules are Lua modules, the obvious thing
to do would be to load the compiled buffers and store the resulting
functions as entries to package.preload. This might be too expensive. I
think what Tomas meant is that you can setup indirect loaders instead.
These would load the appropriate buffers an call them on demand. I agree with him in that this solves the problem I identified.

Nevertheless, I still think it would be nicer if "a" could tell the difference.
My original idea of passing "a.b" in the call to "a", although it breaks
compatibility in the case "a" calls module(...), might not be too bad. How
many people want to write "name independent" modules after all? It's not
like you can change the name of a module without breaking every module that
depends on it. And if you are going to do this, why not change the call to
module() too?

As I said before, I am not going to fight for it... :)

[]s,
Diego.