On Apr 15, 2004, at 10:48 AM, Dan Sugalski wrote:

At this point I can say I don't honestly care all that much, and most of my worries are based on vague feelings that there are platforms out there where finding the actual executable name is somewhere between hard and impossible. I will, then, do the sensible thing and just punt on this--we can work out a best practices thing and enshrine it as the default on systems which can support it and be done with it.

I think it's worth trying out--if it works out, we can build on it; if it doesn't, we can rip it out/redo it. (And, the API could probably stay the same.)


The other question, then, is do we see the need for multiple categories of library which would want separately settable library paths? (Don't, here, forget the potential needs of embedders such as Apache) Once we get that thumped out I'll make the API additions.

We should probably start simple and build, but this would make sense to me (API names are just suggestions):


Parrot_get_configuration_base_path() -- returns the automagically determined path, unless the corresponding Parrot_set_configuration_base_path() had been called to set it to something else.

We could then have individual API to pick out specific resources based on that, but instead, this would be cleaner/simpler:

Parrot_get_path_for_resource(STRING *resource_name) -- returns the equivalent of Parrot_get_configuration_base_path()."/".resource_name, unless you had called Parrot_set_path_for_resource(STRING *resource_name, STRING *path) to set the path for this particular resource to something else. Internally, this could special case certain resources, if needed.

This setup let's us have a stable API, but over time add to the list of things we would look up.

So (assuming for the moment a default layout similar to what we current have), in-core I can call Parrot_get_path_for_resource("library/config.pimc") and Parrot_get_path_for_resource("runtime/parrot/dynext") to locate these resources, by default inside of the base dir. But if I want to have a totally funky layout (in an embedding context, or just if I'm in a weird mood), all I need to do is explicitly call the "set" method (from setup code or from bytecode) to re-point where I find a particular resource.

(So the logic for that could just be to do a hash lookup for any explicitly set values, and fall back to simple concatenation if nothing was in the hash.)

That would all be fairly simple, yet expandable.

JEff

Reply via email to