[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: modules
From: |
Andreas Rottmann |
Subject: |
Re: modules |
Date: |
Sun, 21 Mar 2004 15:47:17 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
Ian Zimmerman <address@hidden> writes:
> 1/ How can I customize a module during loading? In Emacs Lisp,
> I can either:
>
> a) set a global variable, for instance
>
> (setq foo-module:bar 'baz)
>
> prior to loading a library "foo-module". If that library itself does
>
> (defvar foo-module:bar)
>
> it picks up the value that was previously set. But in Scheme, set! only
> works on variables that have already been define'd, and a define creates
> a new variable totally unrelated to the existing value.
>
What exactly do you want to accomplish? The point of modules is to
isolate mostly independent code from each other, and using a global
variable would just prevent that isolation. If you need a global
module setting, you can provide accessor functions:
(define *bar* "The bar")
(define (set-bar! val)
(set! *bar* val))
(define (get-bar)
*bar)
Andy
--
Andreas Rottmann | address@hidden | address@hidden | address@hidden
http://yi.org/rotty | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
Make free software, not war!
- modules, Ian Zimmerman, 2004/03/21
- Re: modules,
Andreas Rottmann <=
- Re: modules, Thien-Thi Nguyen, 2004/03/21