chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] compiling an interpeter script, but remaining interp


From: felix winkelmann
Subject: Re: [Chicken-users] compiling an interpeter script, but remaining interpretable
Date: Fri, 19 May 2006 08:53:29 +0200

On 5/18/06, Graham Fawcett <address@hidden> wrote:
Hi folks,

I just wanted to check my thinking before I began a fool's errand that
would be hard to back out of. I have a small application which runs as
a interpreter script. The script, script.scm, depends on script-lib.scm,
which in turn depends on misc.scm.

I'd like to compile the script, but for debugging purposes I'd still
like to be able to run it in an interpreter. To that end, I've
considered adding declarations like this to my source files:

;; script.scm
(eval-when (eval) (use script-lib))
(eval-when (load) (declare (uses script-lib)))

;; script-lib.scm
(eval-when (eval) (use misc))
(eval-when (load) (declare (unit script-lib) (uses misc)))

;; misc.scm
(eval-when (load) (declare (unit misc)))

It's feasible, I think, but it seems rather cumbersome. Is there a
simpler idiom for keeping the script interpretable, but still
preparing it for compilation? I feel like I'm missing something obvious...


You can also do something like this:

#+csi <expr eval'd when in the interpreter>

#+(not csi) <expr compiled>

"#+X Y" is the same as `(cond-expand (X Y)(else))'


cheers,
felix




reply via email to

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