chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Giving (load)ed files access to macros?


From: felix winkelmann
Subject: Re: [Chicken-users] Giving (load)ed files access to macros?
Date: Mon, 5 Jun 2006 00:13:02 +0200

On 6/3/06, Alejandro Forero Cuervo <address@hidden> wrote:

Hello.

I have chicken egg that exports a "load-extension" function.  These
extensions are just Scheme files that define certain functions (so my
meaning of «extension» in this context does not correspond to the
meaning of «chicken egg»).  Inside, load-extension uses "(load ...)"
to load the file and extract the functions.  Basically, my egg exports
the symbols it expects the extensions to define; the extensions, as a
result of being (load)ed, (define) those symbols; when (load) returns,
my egg captures the current values of those symbols in a table (and
then it is ready to load more extensions).

To define macros that are available at run-time (which seems to be what
you are trying to do), you can put a "(declare (run-time-macros))" in your
(compiled) code. This will make all low-level macros defined with
define-macro available in code eval'd at run-time.
If you need the non-standard syntax-extensions, you can do either:
declare run-time-macros and add "(include "chicken-more-macros")",
which compiles all macros in (makes your code bigger)

or: do a "(eval '(require-extension chicken-more-macros))"),
which loads them (the macro-expanders are now eval'd through the interpreter,
which is slower, but your compiled executable is smalller.


(felix)




reply via email to

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