This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: another (stupid?) module question
- To: "C. Ray C." <crayc at tomcramer dot org>
- Subject: Re: another (stupid?) module question
- From: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Date: 14 Mar 2000 22:02:01 +0100
- Cc: guile at sourceware dot cygnus dot com, djurfeldt at nada dot kth dot se
- Cc: djurfeldt at nada dot kth dot se
- References: <20000314144729.A27179@206.31.63.15> <xy7aek146m9.fsf@mdj.nada.kth.se>
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> > (defmacro define-module args
> > `(let* ((process-define-module process-define-module)
> > (set-current-module set-current-module)
> > (module (process-define-module ',args)))
> > (set-current-module module)
> > module))
>
> It really looks strange.
Ah - got it.
In this module system, one can evaluate `define-module' several times
for the same module. Assume that the module being processed is the
very module which we are evaluating the define-module expression in.
process-define-module has the power of modifying the use-list of the
module, and that could potentially alter the binding of
set-current-module.
The reason for the local bindings is to protect the body of the macro
against a changing top-level environment.
(It could have been done smarter and safer, though.)