Re: Invalid test case. Takashi Kato 21 Mar 2017 07:52 UTC

Then I need a bit more clarification. If the above case is allowed by this
SRFI, then I think it implies one of the following 2 thing:

- define-syntax, let-syntax or letrec-syntax may take sequence of <definition>
  followed by <transformer spec>
  e.g.
  (define-syntax foo (begin (define bar 0) (syntax-rules () ((_) bar))))

or

- <macro use> inside of the <transformer spec> must specially be handled to
  detect any <definition>

Either way, it's nice to be clarified by post finalization note.

Cheers,

_/_/
Takashi Kato

On 20 March 2017 at 22:41,  <xxxxxx@nieper-wisskirchen.de> wrote:
> Hi,
>
> thanks for asking this question.
>
> Am 08.03.2017 um 10:06 schrieb Takashi Kato:
>> Hi,
>>
>> I believe the test case "Auxiliary definitions in custom macro
>> transformers" is incorrect. The
>> definition of the test is the following:
>>
>> (define-syntax my-macro-transformer
>>   (syntax-rules ()
>>     ((my-macro-transformer)
>>      (begin (define foo 2)
>>         (syntax-rules ()
>>           ((_) foo))))))
>> (letrec-syntax ((foo (my-macro-transformer)))
>>   (foo))
>>
>> However this would be expanded to like this:
>>
>> (letrec-syntax ((foo (begin (define foo 2)
>>                             (syntax-rules ()
>>                               ((_) foo)))))
>>   (foo))
> The spec allows that "in order to facilitate writing sophisticated
> custom macro transformers" transformer specs expand into sequences of
> multiple definitions eventually followed by a transformer spec (which is
> the case in the example above). The scope of these definitions are in
> the scope of the bindings of the letrec-syntax binding construct.
>
> The "foo" inside "(define foo 2)" and the foo in the syntax-rules
> template are effectively being renamed due to hygiene. Thus, the whole
> construct expands into "2".
>
> Was my explanation helpful?
>
> Best,
>
> Marc
>

--
_/_/
Takashi Kato
E-mail: ktakashi19@gmail.com