[gambit-list] Macros, separate files, and all that

Jeff Read bitwize at gmail.com
Thu Jan 31 14:46:48 EST 2013


On Jan 31, 2013 2:35 PM, "Bradley Lucier" <lucier at math.purdue.edu> wrote:

> I understand what you're saying, I understand your coding style.
>
> What I don't understand is why, if I load the source (*.scm) of the
macros into the REPL of gsc, the macros are available to expand the source
of later files during compilation, while if I load the compiled (*.o*)
versions of the same file into the REPL of gsc, those macros are *not*
available to expand the source of later files during compilation.  (I think
I gave sufficient examples to illustrate this in my previous e-mail.
>

Macros have file scope in compiled code.

I'm not sure on the details, but if I were to guess I'd say that the
compiler macro-expands and then compiles, not bothering to write the macro
definitions into the compiled module; whereas if you `load' scheme source,
it's like you typed each expression singly at the REPL, and those macro
definitions become available.

In general, for gambit it's not safe to assume your macro definitions will
be visible outside the file they were defined in.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130131/408748ff/attachment.htm>


More information about the Gambit-list mailing list