lua-users home
lua-l archive

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


> ... path available to module being loaded...

OK.  I guess that if it's in the preload table, the environment is
under tighter control anyway, so the problem more or less goes away.
But I get your symmetry point.

One of the advantages of this symmetry is that library writers will
end up writing libraries that do not depend on the path. :) With that,
it is up to the user of the library if he wants to link everything
static or not.

1)  "module" binds to the "require"-ed name, not to the module name.

And how is "module" supposed to know what was the required name? Maybe
some magic environment trick...

No magic at all.  I implemented it (in Lua of course!) by letting
require and module share the required name through an upvalue.  In a C
implementation you have to share it in some other way.

Do you mean you create a new module() function for each package that is
required? This can be done in C too. Do you place it in the namespace
for the module? Only slightly more complicated than the current scheme, but
if it fixes all problems, I like the idea. Shall we go over all our
pathologic problems and see what happens differently? :)