On Fri, Oct 06, 2006 at 09:02:35AM +0100, David Jones wrote:
You could modify the loader so that some sort of reference (which
need not always be a pathname, but let's simplify and say it is) to
the module's location was passed to the module when it was
'require'ed. The module could then add this location to its loadpath
before 'require'ing anything. Automatically, natch. In fact, I
don't see why you need to pass the module location to the module, the
modified package system can just set it up so that it works behind
the scenes.
These won't be modules; they'll be small code snippets, small chunks
that will just construct and return a table. They'll want to be able
to source in other similar chunks, to evaluate and recursively include
as subtables. They won't be retained, but just loaded onto the stack
from disk (possibly precompiled, of course), evaluated once and
discarded.