guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] local-eval, local-compile, and the-environment (v3)


From: Mark H Weaver
Subject: Re: [PATCH] local-eval, local-compile, and the-environment (v3)
Date: Mon, 16 Jan 2012 04:07:29 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

I wrote:
> * Also note that the real `current-module' simply accesses a fluid,
>   which can also be set by `set-current-module'.  (Fluids are a scheme
>   analogue to "dynamically-scoped" variables in Lisp).  Conceptually, it
>   is variable that is explicitly set by the user.  It has no relation to
>   the code that is currently executing.  Rather, it is used during
>   compilation (or within a REPL) to keep track of where the user would
>   like top-level definitions to go.

That last bit was not quite right, let me try again:

   The `current-module' is used during compilation, within a REPL, or by
   primitive-eval, to keep track of which module the user would like
   top-level forms to be compiled in.  It is set at compile time by
   constructs such as `define-module' or (eval-when (compile)
   (set-current-module <module>)), and this module is baked into every
   identifier at compile time before macro processing takes place.

   Macros in general might slice and dice and mix together fragments of
   code from many different modules.  When this jumble of macro-expanded
   code is evaluated, (current-module) is no longer relevant to it.
   Instead, each top-level variable reference uses the module that was
   baked into its identifier before macro expansion.

      Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]