unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* access of global variables from modules
@ 2002-03-30 22:43 Mr. Peter Ivanyi
  2002-04-01 14:26 ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Mr. Peter Ivanyi @ 2002-03-30 22:43 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-04-01 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-30 22:43 access of global variables from modules Mr. Peter Ivanyi
2002-04-01 14:26 ` Neil Jerram
2002-04-01 15:24   ` Mr. Peter Ivanyi
2002-04-01 18:29     ` Neil Jerram

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).