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: Alejandro Forero Cuervo
Subject: Re: [Chicken-users] Giving (load)ed files access to macros?
Date: Mon, 5 Jun 2006 00:19:43 -0500
User-agent: Mutt/1.5.9i

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

Hmm, this doesn't seem to work. :-/  I have a file test.scm with the
following code:

    (declare (run-time-macros))
    (load "foo.scm")

In foo.scm I have this:

    (receive (a) #f a)

However, I get:

    $ csi -script test.scm # does work
    Warning: declarations are ignored in interpreted code
    (##core#declare (quote (run-time-macros)))
    $ csc test.scm
    $ ./test 
    Error: unbound variable: a

            Call history:

            test.scm: 2    load
            <eval>          (receive (a) #f a)
            <eval>          (a)     <--

Am I doing something wrong?

On the other hand, using (eval '(require-extension
chicken-more-macros)) seems to work slightly better but still not
satisfactorily: I can't make my extensions load macros from extensions
that have already been loaded by the compiled code.

For example, I have:

test.scm:

    (require-extension srfi-40)
    (eval '(require-extension chicken-more-macros))
    (load "foo.scm")

foo.scm:

    (require-extension srfi-40)
    (stream-cons #f stream-null))

If I run the compiled test program I get:

    Error: unbound variable: stream-cons

How can my extensions use macros defined in Chicken eggs that are used
by the compiled code?

As you might suspect, the extensions here are those that define new
tags such as <example> ... </example> or <procedure> ... </procedure>
for svnwiki.  :-)

Thanks for your help, Felix!
 
Alejo.
http://azul.freaks-unidos.net/




reply via email to

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