[plt-scheme] srfi 0 or conditonal expansion

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Wed Jun 6 09:47:16 EDT 2007

As you expected, the former (more likely one) happens.

(require (lib "7.ss" "srfi"))
(program (requires srfi-9)
         (feature-cond
          (else (code (define y 6)))))
y

=> 6

You are missing a "code" in the code.

Chongkai

YC wrote:
> Thanks Chongkai for the suggestion.
>
> Looking at the doc it can only do conditional expansion based on 
> availability of srfi-x, so I would probably have to try to hack my own 
> solution based on the design.
>
> On the other hand, I seem to either have a misunderstanding of the 
> SRFI or come across a bug (I would assume the former is more likely... 
> ;P):
>
> (require (lib "7.ss" "srfi"))
> (program (requires srfi-9)
>          (feature-cond
>           (else (define y 6)))) ; should unconditionally provide the 
> feature
> y ; expects 6
> ; but results in error:
> ; program: bad syntax in: (program (define y 6))
>
> Looking at program.ss it shows the following syntax-case:
>
>     ((_
>       (feature-cond (else stuff ...))
>       more ...)
>      (syntax
>       (program
>        stuff ...
>        more ...)))
>
> Shouldn't this be expanded to
>
> (syntax
>  (begin
>    stuff ...
>    (program more ...)))
>
> ?
>
> Thanks,
> yinso
>



Posted on the users mailing list.