This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: another (stupid?) module question


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]