[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Macros at runtime
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Macros at runtime |
Date: |
Wed, 6 Sep 2006 09:31:08 +0200 |
On 9/6/06, Carlos Pita <address@hidden> wrote:
Hi all!
I've a strange problem when including macros from the
interpreter. For example, the file test.scm below runs
fine if csi first evals (use syntax-case) and then
includes it; but if csi directly includes the file
(which itself requires syntax-case), an error occurs:
Yes, this is a known problem with the macro-expansion
mechanism used in chicken: "include" is handled in such
a way that is reads expressions and inserts them into the
current place. Macros are not expanded, since that is done
in the subseqent evaluation phase.
In syntax-case, the situation is different - here a toplevel
expression is expanded completely, and the "include" macro
reads expressions and performs this complete expansion
(the definition of "include" is implemented purely as a macro,
and not built-in as with low-level macros).
So when using syntax-case, an "included" file can not change
the mechanism how "include" is handled on the fly. The only solution
is to to use syntax-case in a separate step, for example by passing
"-R syntax-case" to csi, or putting it into your .csirc, or doing
"(use syntax-case)".
Also, as we are on
it, what is -run-time-macros supposed to do? The
documentation says "macros are made available at
run-time", but even when compiling with
-run-time-macros I can't expand sr-and from csi just
loading the .so (I have to include the .scm).
The "run-time-macros" declaration has no effect when using
syntax-case.
cheers,
felix
--
http://galinha.ucpel.tche.br:8081/blog/blog.ssp