chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] syntax-case and #!rest, second attempt


From: mark
Subject: Re: [Chicken-users] syntax-case and #!rest, second attempt
Date: Sun, 26 Aug 2007 16:16:20 +0200 (CEST)
User-agent: SquirrelMail/1.4.10a

Thanks, Zbigniew. I indeed figured out the renaming of #!rest before
Chicken sees it. But I didn't think of the hack and I'll give it a try
soon. However, it is not a nice solution and my guess would be that the
syntax-case egg should have a build in exception for the #!key and #!rest
keywords, so that they will not be renamed. I have no clue how to do that
at this moment though.

Cheers,
Mark


> Mark,
>
> The #!rest syntax is supported directly by Chicken and it appears the
> extra indirection involved in syntax-case is causing the #!rest
> keyword to be renamed before Chicken sees it (as you've probably
> surmised).  I do not know an easy way to fix this offhand, although
> some syntax-case wizard might.  However, you might wish to try the
> horrible hack below, which may work in a limited fashion.
>
> (define-syntax test
>  (lambda (x)
>    (syntax-case x (#!rest)
>      ((_ (name arg ... #!rest r) e0 e1 ...)
>       (syntax
>        (define (name arg ... . r)
>          e0 e1 ...)))
>      ((_ (name ...) body ...)
>       (syntax
>        (define (name ...)
>          body ...))))))
>
> On 8/25/07, address@hidden <address@hidden> wrote:
>> Folks,
>>
>> Since I'm still having problems with syntax-case and rest arguments, I
>> have devised the following example which hopefully makes my problem
>> clear:
>>
>> (define-syntax test
>>   (lambda (x)
>>     (syntax-case x ()
>>       ((_ (name ...) body ...)
>>        (syntax
>>         (define (name ...)
>>           body ...))))))
>






reply via email to

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