define-syntax inside of let(rec)-syntax doesn't confirm R6RS

Create issue
Issue #11 resolved
Takashi Kato repo owner created an issue

This script should print foo

(import (rnrs))
(let-syntax ((a (syntax-rules () ((_) 'foo))))
  (define-syntax b (syntax-rules () ((_) (a)))))
(display (b))

However, because of the lazy macro expansion, compiler expands (b) to (a) then tries to expand (a) and gets unbound variable error since a is locally bounded and already discarded at this point.

To resolve this, there are 2 ways;

  1. expand local macro during first expansion
  2. lookup a from identifier's environment

2 is a bit awkward so 1 is preferable.

Comments (1)

  1. Log in to comment