chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] How to avoid predefined cond-expand features in csc?


From: Peter Bex
Subject: Re: [Chicken-users] How to avoid predefined cond-expand features in csc?
Date: Thu, 24 Dec 2015 11:25:23 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Dec 24, 2015 at 11:10:40AM +0100, Sven Hartrumpf wrote:
> Hi.
> 
> csc seems to predefine some cond-expand feature (srfi-1, srfi-13, srfi-14,
> srfi-69, maybe more) for the program to be compiled. How to prevent this?

These features are a bit weird: when you require a core library, it will
register a feature with the same name (I think that's to prevent it from
being reloaded again).  I'm not sure if this is in general for units or
only for core units, but I think the problem here is that the compiler
loads all of them.  So you're really cond-expanding against what's
been loaded by the compiler, which is of course undocumented and subject
to change.

> (I fear that this has been asked before, but I could not find the answer.)

I don't think it's been asked before.

> Example:
>  > echo "(cond-expand (srfi-1 (print "srfi-1")) (else))" > bugchicken2.scm
>  > csi -e '(load "bugchicken2.scm")'
>  >            -> as expected
>  > csc bugchicken2.scm && ./bugchicken2
> srfi-1        -> unexpected; csc should behave like csi.

If you don't mind doing this at runtime, that's a solution:

(when (feature? srfi-1:) (print "srfi-1"))

Of course, if you load a library which indirectly depends on srfi-1,
that means this will get expanded to the print anyway.

Hope this helps!

Cheers,
Peter

Attachment: signature.asc
Description: Digital signature


reply via email to

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