[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] Re: cond-expand and macros
From: |
felix |
Subject: |
[Chicken-hackers] Re: cond-expand and macros |
Date: |
Mon, 23 Nov 2009 00:42:28 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Thomas Bushnell BSG <tb <at> becket.net> writes:
>
> I thought (erroneously) that the problem I reported previously was that
> somehow the feature set available to cond-expand inside a syntax-rules
> template was the evaluation one and not the compilation one. No, the
> situation is far worse.
>
> The following code does not work:
>
> (define-syntax foo
> (syntax-rules ()
> ((_)
> (cond-expand
> (chicken (display "all good\n"))))))
> (foo)
>
> It does not work whether compiled or evaluated; the issue of
> compile-time is a complete red herring, and my previous email was
> incorrect in implying that compile vs. eval was relevant. AFAICT, it's
> not.
>
> I submit that the failure of the above code is a clear bug,
> unambiguously.
>
Absolutely correct. The feature-identifier is not stripped of syntactical
context information. This patch will help:
diff --git a/expand.scm b/expand.scm
index 053e278..cca83fc 100644
--- a/expand.scm
+++ b/expand.scm
@@ -1195,7 +1195,7 @@
x
(cons 'cond-expand clauses)) )
(define (test fx)
- (cond ((symbol? fx) (##sys#feature? fx))
+ (cond ((symbol? fx) (##sys#feature? (##sys#strip-syntax fx)))
((not (pair? fx)) (err fx))
(else
(let ((head (car fx))
cheers,
felix
[Chicken-hackers] Re: cond-expand and macros,
felix <=