Summary
r7rs incompatibility regarding identifier renames in macro expansion
Metadata
- Id: a9cbf082bdca039cdb34c5e1f7b0be865b5596df
- Trac id: 1793
- Type: defect
- Reporter: sjamaan
- Owner:
- Cc:
- Status: closed
- Component: expander
- Estimated difficulty: hard
- Resolution: worksforme
- Priority: major
- Milestone: 6.0.0
- Version: 5.2.0
- Changetime: 2023-11-14 18:40:51 UTC
- Created: 2021-10-15 08:11:40 UTC
- Keywords:
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.