guile-user
[Top][All Lists]
Advanced

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

Re: the module system ?


From: David Pirotte
Subject: Re: the module system ?
Date: Tue, 06 Mar 2001 19:34:59 +0100

Martin Grabmueller wrote:
> >
> > (define (close-db . con?)
> >   (set! pg-con '())
> >   (if (not (null? con?))
> >       (eval `(set! ,(car con?) '()))))
> 
> A question: What is it you are doing here?  The use of eval looks a
> bit strange, you are passing a symbol to `close-db' which gets set to
> '().  This will most probably result in an error if you are calling
> the procedure from another module, because variables always belong to
> the module where they are defined in.

Let's forget about this, I admit it is a bit strange. I wanted to be 'clean',
with the job to be accomplished by db-close, including bounding the variable
to nil, which required to pass its symbol-name but it is probably not a good
idea.

> > 2] when I try to use it:
> > ------------------------
> 
> ...
> You have to make sure that the variable `pg-connectdb' is exported
> from the module where it is define (I assume it is (database
> postgres)).

Yes, I am sure it is exported. The reason I sent the mail to guile-user list is 
because
it seems that the behavior of guile is different whether you launch guile in a 
shell
and then 'manually' use-modules, as I showed above, or whether you launch it
as is (assuming the following is in a file "tactus.scm"):

        #!/usr/local/bin/guile -s
        !#

        (use-modules (alto db-stuff))

        (define pg-con
          (open-db "tactus" "david"))

        (display pg-con)
        (display "\n")

        (set! pg-con '())

and then:

        address@hidden:~/alto/projects/guile/tactus 27 $ ./tactus.scm
        #<PG-CONN:1:tactus:localhost:5432:>
        address@hidden:~/alto/projects/guile/tactus 28 $ 

as you see, it works perfectly fine, so why does it not work from a guile 
listener?

thanks,
David




reply via email to

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