Mark H Weaver <[email protected]> skribis:

> [email protected] (Ludovic Courtès) writes:
>
>> Mark H Weaver <[email protected]> skribis:
>>
>>> [email protected] (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’.

Reply via email to