This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Something wrong? [fwd: Protecting namespaces]


I sent this a while ago, but I haven't seen it on the list and
neither did it return.

----- Forwarded message from Lalo Martins <lalo@webcom.com> -----

Message-ID: <19990119162349.A1314@lalo.ddns.org>
Date: Tue, 19 Jan 1999 16:23:49 -0200
From: Lalo Martins <lalo@webcom.com>
To: guile@cygnus.com
Subject: Protecting namespaces

Ok, I will not try to generalize the problem or I will make a
mess of it :-) the real-life problem is:

My C program will be able to load Guile files - say - "pi/x",
"pi/y" and "pi/z". They all will define functions with the same
name (wrapped by the program, before loading the Guile files, in
modules "feast pi x", "feast pi y" and "feast pi z").

So inside "feast pi x" there will be functions "a" "b" "c", and
inside "feast pi y" there will be a _different_ "a", a different
"b" and a different "c" and so on.

Now, the info file does some comparation to Python's "import x"
as opposed to "from x import *", but on the rest of the
documentation I see no way to do "import x" (and then "x.a"
which is more important). AFAICS "require 'x" is like "import
x", have I missed something?

----- End forwarded message -----

This is what I found out in the meanwhile (in the archives):

        ;;save current module
        (define top (current-module))
        (define x 1)
        x ; yields 1

        ;;create and switch to a new module, called (foo bar)
        (define-module (foo bar))
        (define x 2)
        x ; yields 2

        ;;switch back to the initial module
        (set-current-module top)
        x ; yields 1 again


Is this the "Correct" (TM) way? Is anyone working on the modules
documentation? Or is the new module system expected to be
completely incompatible and due soon?

[]s,
                                               |alo
                                               +----
--
      I am Lalo of deB-org. You will be freed.
                 Resistance is futile.

http://www.webcom.com/lalo      mailto:lalo@webcom.com
                 pgp key in the web page

Debian GNU/Linux       --        http://www.debian.org