Out of scope syntax-parameterize and local variables
jcubic opened this issue · 1 comments
jcubic commented
I'm implementing syntax-parameterize in my Scheme interpreter and testing the implementation with Chez Scheme and found a bug in Chez. Here is a use case:
(define-syntax foo
(syntax-rules ()
((_ body ...)
(begin
(syntax-parameterize
((it (syntax-rules ()
((_) "hello world")))))
body ...))))
Where the body is outside of syntax-parameterize
.
Both expressions:
(let ((it 10))
(print (foo (it))))
(foo (let ((it 10))
(print it)))
throws:
Exception: variable it is not bound
But it should throw an error about 10 not being a function. This should work:
(let ((it 10))
(print (foo it)))
and display 10
but it gives an exception.
The above works in Guile.
jcubic commented
Sorry my bad, I was confused about error messages because it didn't give an error about unbound syntax-parameterize
only about (it)
because it tried to execute it from this expression:
((it (syntax-rules ()