guile-user
[Top][All Lists]
Advanced

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

Re: loading a module via an absolute path


From: Paul Jarc
Subject: Re: loading a module via an absolute path
Date: Fri, 18 Oct 2002 19:26:02 -0400
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

Marius Vollmer <address@hidden> wrote:
> address@hidden (Paul Jarc) writes:
>> Is there any chance of extending use-modules (or providing a
>> cooperating procedure) to allow things like:
>>
>> (use-modules ("/path/to/foo.scm" :select ...))
>
> Could you use the this?
>
>   (load "/path/to/foo.scm")
>   (use-modules (NAME :select ...))

That's not quite what I'm looking for.  The way I did it, I don't use
define-module at all; the imported code doesn't know or care what name
the importing code uses to refer to it.  The loader procedure takes
care of creating a new (anonymous) module, and loads the code into it.
The importing code gets a reference to the module containing the
imported code, and binds that value to a normal variable, and uses
module-ref to fetch things it wants.  It's much like dlopen and dlsym
(not that I'm more than slightly familiar with them).

I'd be happy to keep using my loader, except that the modules it
creates (with make-safe-module) are too sparse - lacking useful things
like, say, defined?.  OTOH, a library loaded by use-modules has all
the normal bindings at its disposal.  How can I create a module like
that?


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]