guile-user
[Top][All Lists]
Advanced

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

the module system ?


From: David Pirotte
Subject: the module system ?
Date: Tue, 06 Mar 2001 11:43:54 +0100

Hi,

I am quite lost with respect to how the module system works. Here
is what I thought would be correct:

1] my module def and relative code:
-----------------------------------

(define-module (tactus db-stuff)

  ;; from distribution
  :use-module (database postgres)
  :use-module (ice-9 format)
  
  ;; from alto

  )

(export ;; pg-con
        open-db
        close-db
        ;; get-db-con-str
        )

(setenv "PGDATESTYLE" "German")

(define (open-db dbname user . options)
  ;; (format #t "dbname=~A user=~A options=~S~%" dbname user options)
  (if (null? options)
      (pg-connectdb (format #f "dbname=~A user=~A" dbname user))
      (pg-connectdb (format #f "dbname=~A user=~A ~A" dbname user options)))
  )

(define (close-db . con?)
  (set! pg-con '())
  (if (not (null? con?))
      (eval `(set! ,(car con?) '()))))


2] when I try to use it:
------------------------

address@hidden:~/alto/projects/guile 58 $ guile
guile> (use-modules (tactus db-stuff))
guile> (open-db "tactus" "david")
/usr/alto/projects/guile/tactus/db-stuff.scm:26:7: In expression (pg-connectdb 
(format #f "dbname=~A user=~A" ...)):
/usr/alto/projects/guile/tactus/db-stuff.scm:26:7: Unbound variable: 
pg-connectdb
ABORT: (unbound-variable)

Type "(backtrace)" to get more information or "(debug)" to enter the debugger.
guile> 

3] so, I hope we do not have to always have to know and load the modules 
required
by the modules we want to use ...

What is it that I don't understand?
many thanks for some hints
David




reply via email to

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