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