Opened 3 years ago

Closed 11 months ago

#1793 closed defect (worksforme)

r7rs incompatibility regarding identifier renames in macro expansion

Reported by: sjamaan Owned by:
Priority: major Milestone: 6.0.0
Component: expander Version: 5.2.0
Keywords: Cc:
Estimated difficulty: hard

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...

Change History (3)

comment:1 Changed 3 years ago by sjamaan

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

comment:2 Changed 11 months ago by felix winkelmann

Milestone: 5.46.0.0

comment:3 Changed 11 months ago by felix winkelmann

Resolution: worksforme
Status: newclosed

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

Note: See TracTickets for help on using tickets.