lua-users home
lua-l archive

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



On 6 Oct 2006, at 09:23, Glenn Maynard wrote:

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.

This is just a vocabulary issue.

What mystic forces locates "code snippets" can arrange that when a located code snippet wants to "source in" another chunk the mystic invocation that it uses to do that "source in" the other code chunk is able to find the code chunk using the information that was obtained when the first code snippet was located.

You presumably have some function "foo" that finds another code chunk and runs it? "foo" can arrange that when it is running another code chunk and that code chunk does "foo" its "foo" is able to find code chunk relative to the first one. "foo" knows this because it found the first code chunk in the first place.

Can't it? Anyway, like I said, the debug API seems okay to me. It's more of a reflexion API really.

drj