chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] (use foo) versus (declare (uses foo)), csi versus cs


From: Peter Bex
Subject: Re: [Chicken-users] (use foo) versus (declare (uses foo)), csi versus csc
Date: Sun, 21 Oct 2007 12:32:28 +0200
User-agent: Mutt/1.4.2.3i

On Fri, Oct 19, 2007 at 06:06:59PM -0500, Zbigniew wrote:
> OK, try this.
> 
> bar.scm:
> 
> (define-extension bar)
> 
> (define (fac n)
>   (if (zero? n)
>       1
>       (* n (fac (- n 1))) ) )
> 
> foo.scm:
> 
> #+compiling (declare (uses bar))
> 
> (use bar)
> (write (fac 10)) (newline)
> 
> With this incantation you cannot automatically include bar into foo as
> as a shared library.  To include a shared bar.so, remove the entire
> #+compiling line.  Alternatively you can bypass the requirement for
> this #+compiling directive in the first place by passing "-uses bar":
> 
> $ csc -uses bar foo.scm bar.scm -o foo
> 
> Then remove the -uses option if you want to compile shared.

Why is the difference between compiled and interpreted mode there?
The meaning of these things isn't fundamentally different between the two
modes, is it?  Can't (declare) statements be parsed by the interpreter as
well?

I understand that dynamic (use) calls (within if or cond, for example)
can't be compiled, but surely the interpreter can pick up the compiler hints..

Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpfPFRRnN5dB.pgp
Description: PGP signature


reply via email to

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