Summary

r7rs incompatibility regarding identifier renames in macro expansion

Metadata

Description

See this post:

 (let ([x 'outer])
    (define-syntax m
      (syntax-rules ()
        ((m a)
         (let ([a 'inner]) x))))
    (m x)) ;; Should return 'outer, which we do



 (let ([x 'outer])
    (define-syntax m
      (syntax-rules ()
        ((m a)
         (begin
           (define a 'inner)
           x))))
    (m x)) ;; Should return 'inner, which we don't

It makes sense, because the outer `x` variable is passed in as `a`, which is then redefined to `inner`, and whether we return `a` or `x` should not matter, the result should be the same.

Not sure why this wouldn't be valid in R5RS though...

Changes and comments

[2021-10-15 12:33:44 UTC] sjamaan wrote:

NOTE: This might be due to the duplicate lookup in `##sys#current-environment` as mentioned in #1131

[2023-11-06 22:08:18 UTC] felix changed milestone from 5.4 to 6.0.0

[2023-11-14 18:40:51 UTC] felix changed status from new to closed

[2023-11-14 18:40:51 UTC] felix set resolution to worksforme

[2023-11-14 18:40:51 UTC] felix wrote:

I can't reproduce this with the current version, perhaps this was fixed in the meantime by a correction related to this.