syntax-rules variable reference error

Issue #7 resolved
Takashi Kato repo owner created an issue

This must be run properly

pattern-match-lambda

At this point, the reason why this doesn't work properly is that template variable doesn't have proper environment when each time it's created and it is impossible to refer it.

We may need rather drastic change of macro expansion.

Comments (3)

  1. Takashi Kato reporter

    This should be the smallest code to reproduce the issue.

    (import (rnrs))
    
    (define-syntax wrap-local
      (syntax-rules ()
        ((_ expr) 
         (let-syntax ((foo (syntax-rules () ((_) expr))))
           (foo)))))
    
    (define-syntax wrap
      (syntax-rules ()
        ((_ e)
         (let ((temp e))
           (wrap-local (car temp))))))
    
    (wrap '(a b c))
    ;; -> should be 'a but unbound variable temp
    
  2. Log in to comment