[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] require-extension and the compiler
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] require-extension and the compiler |
Date: |
Mon, 26 Sep 2005 08:28:26 +0200 |
On 9/25/05, Shawn Rutledge <address@hidden> wrote:
> So after installing spiffy I wanted a way to start it automatically
> from /etc/init.d, so I wrote this spiffyd.scm:
>
> (require-extension spiffy)
> (load "/etc/spiffy-conf.scm")
> (start-server)
>
> and it works fine if I run it with csi. If I compile it, then as long
> as I have previously loaded the extension with csi, the binary will
> also work. But if I log out of this machine and then log back in and
> just run the binary, I get an error like this:
>
> [nucleus][01:12:34 PM] /usr/local/bin/spiffyd
> Error: unbound variable: require-extension
>
> ##sys#require
>
> Obviously some kind of caching is going on but I'm a bit surprised by
> this behavior. I finally RTFM'd a bit about require and
> require-extension, but when I use require it loads spiffy.scm, and
> when I use require-extension, it loads the .so. I imagine the latter
> is more efficient.
>
> This is with chicken 1.89, maybe should try 2.0...
>
`require-extension' wasn't available with the minimal set
of macros in Chicken versions before 2.2.
I recommend running spiffy exclusively in csi, since you need
an interpreter with all non-standard macros anyway.
Alternatively, do an
(eval '(require-extension chicken-more-macros))
at runtime to have non-standard syntax available (but
the macro-expanders are interpreted, then. Also needs a newer
chicken).
To have a fully compiled, custom interpreter with non-standard
syntax, put
(declare (run-time-macros))
(include "chicken-more-macros")
into your code.
If you want syntax-case (at runtime) instead, a
(eval '(require-extension syntax-case))
should be enough.
No, this all isn't particularly logical at all, but how boring life
would be without a bit of lore... ;-)
cheers,
felix