[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] psyntax: custom ellipses using 'with-ellipsis' or R7RS synta
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules |
Date: |
Fri, 10 Jan 2014 21:36:40 +0100 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Mark H Weaver <address@hidden> skribis:
> address@hidden (Ludovic Courtès) writes:
>
>> Mark H Weaver <address@hidden> skribis:
>>
>>> address@hidden (Ludovic Courtès) writes:
[...]
>> Sorry I wasn’t clear. Does this work:
>>
>> (define-syntax define-inline
>> (with-ellipsis ---
>> (syntax-rules ()
>> ((_ (name parms ---) exp ---)
>> (define-syntax name
>> (with-ellipsis --- ; <- note here!
>> (syntax-rules ()
>> ((_ args (--- ---))
>> ((lambda (parms ---) exp ---)
>> args (--- ---))))))))))
>>
>> IOW, does the escaping syntax adjust to the current ellipsis?
[...]
> Since you chose the same ellipsis identifier for both the inner and
> outer macros, you need to escape the ellipsis passed to the inner
> 'with-ellipsis', just as you need to escape any ellipsis that you want
> to remain present in the generated code.
Arf, right, my bad. That makes a lot of sense.
[...]
>>> I ended up making the effect of 'with-ellipsis' propagate into syntax
>>> definition forms, since the semantics seem simpler to me.
>>
>> OK.
>>
>> So does that mean that in the example above the second ‘with-ellipsis’
>> can now be omitted, or is it limited to ‘let...-syntax’?
>
> No, it's not limited to 'let...-syntax'. The effect of 'with-ellipsis'
> propagates into 'define-syntax' forms well.
OK.
> However, you still need the second 'with-ellipsis' in your example,
> because the effect of 'with-ellipsis' does not affect the ellipsis of
> the generated code. If you want one macro to generate another macro
> definition that uses a custom ellipsis, you must include 'with-ellipsis'
> in the generated code.
Yes, understood.
Thanks for explaining!
Ludo’.