unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Mr. Peter Ivanyi" <peteri@carme.sect.mce.hw.ac.uk>
Subject: access of global variables from modules
Date: Sat, 30 Mar 2002 22:43:45 +0000	[thread overview]
Message-ID: <3CA63FA1.5FBAC15@carme.sect.mce.hw.ac.uk> (raw)

Hello again,

I have another problem with modules.
If I have a module can the module access "global" variables.
I have an application, which defines some global variables. 
The application also loads some modules and I would like to access
the global variables from the module. 
How can I do it ? (I think I can put the global variables into a module
and another module can depend on it, but isn't there another way ?)

For example I have this module (gen.scm):
----------------------
(define-module (gen gen))
(export gen-hello)

(define (gen-hello)
  (set! *G* 3)
  (display "Hello World !")
  (newline)
)
-------------------------

then I receive this

-------------------------
peteri@mercury $ guile
guile> (define *G* 1)
guile> (use-modules (gen gen))
guile> (gen-hello)
./gen/gen.scm:7:1: In expression (set! *G* 3):
./gen/gen.scm:7:1: Unbound variable: *G*
ABORT: (unbound-variable)

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

instead of setting *G* to 3 and then print "Hello World !".

Thanks, for your help in advance.

					Peter Ivanyi

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


             reply	other threads:[~2002-03-30 22:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-30 22:43 Mr. Peter Ivanyi [this message]
2002-04-01 14:26 ` access of global variables from modules Neil Jerram
2002-04-01 15:24   ` Mr. Peter Ivanyi
2002-04-01 18:29     ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CA63FA1.5FBAC15@carme.sect.mce.hw.ac.uk \
    --to=peteri@carme.sect.mce.hw.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).