chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Macro using procedure


From: felix winkelmann
Subject: Re: [Chicken-users] Macro using procedure
Date: Fri, 9 Mar 2007 14:55:36 +0100

On 3/9/07, Daniel Sadilek <address@hidden> wrote:
Hello,

I want to write a macro that uses a help procedure. The following code
does not compile but in the interpreter it works and prints out "hi".
---------------------
(use syntax-case)

(define (macrohelper param)
  param)

(define-syntax testsyntax
  (lambda (x)
    (syntax-case x ()
                 ((_ foo)
                  (with-syntax ((bar (macrohelper (syntax foo))))
                               (syntax (display 'bar)))))))

(testsyntax hi)
(newline)
---------------------

The faq explains that during compilation "macrohelper" is not visible
but does not provide a solution :(
In the mailing list archive I found the suggestion to use eval-when
but that didn't work either.
(I changed the definition of macrohelper to:
---------------------
    (eval-when (compile eval)
           (define (macrohelper param)
             param))
---------------------
)


The latter doesn't work due to a problem with the syntax-case
integration: it thinks it is a local definition.

Use `(define-for-syntax (macrohelper ...) ...)"


cheers,
felix




reply via email to

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