The interpreter has a library array. We can stick it somewhere in the
interpreter structure and hang it off the interpinfo op to get to it.
Each element in the array is a sub PMC. The prototype is:
int loader(string)
The return is:
1 - no good, try the next entry in the array
0 - Good, done
-1 - good, try the next entry in the array anyway
exception - something went wrong
The string parameter is the unqualified name of the library to load.
The parameter is explicitly writable so filter entries can mess with
it if they want.
If the last entry in the array returns non-zero, then a library load
fail exception is thrown.
This does mean that each plain directory in the library path has to
have what's essentially a closure backing it which is capable of
loading in a file from disk into the interpreter, but I'm OK with
that. It'll make wedging in more active library loading code easier
in general, which is fine.
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk
jens
The handler returns -1 in those cases where it's rewritten the
library name. It'll also return that in the case where it may have
done something successful (such as log the load request) but wants
the load to continue anyway.
Arguably no loader in the list ever has to return a -1 result, as
they could still do their thing and return a 1, but I figured it'd be
useful to have a way for loaders to indicate they did something but
that the search wasn't over.