[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-mit-scheme] [bug #55090] 9.2 -> 10.1 breaks macro by skipping some
From: |
Arthur A. Gleckler |
Subject: |
[Bug-mit-scheme] [bug #55090] 9.2 -> 10.1 breaks macro by skipping some variable renaming |
Date: |
Sat, 24 Nov 2018 18:50:57 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?55090>
Summary: 9.2 -> 10.1 breaks macro by skipping some variable
renaming
Project: MIT/GNU Scheme
Submitted by: aag
Submitted on: Sat 24 Nov 2018 11:50:55 PM UTC
Category: runtime
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect behavior
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Keywords:
_______________________________________________________
Details:
While porting my code to 10.1, I've found one macro that no longer works. The
problem is that one variable is no longer renamed upon a recursive macro call.
Since the same macro worked under 9.2 and with other syntax-rules
implementations (e.g. it's part of the implementation of SRFI 146, which runs
on other Schemes), I'm fairly confident that this is a bug.
For this bug report, I've pared the macro down to this:
(define-syntax vector-edit-code
(syntax-rules ()
((_ v r o s)
(let ((index (vector-length v)))
(subvector-move-left! v o index r (+ o s))
r))
((_ v r o s i e)
(let ((index i))
(subvector-move-left! v o index r (+ o s))
(vector-set! r (+ s index) e)
(let ((skew (1+ s)))
(vector-edit-code v r index skew))))))
Here's an example:
(pp (lambda () (let ((input (vector 0 1 3))) (let ((array (make-vector 4)))
(vector-edit-code input array 0 0 2 2)))))
In 9.2, evaluating that expression produces:
(lambda ()
(let ((input (vector 0 1 3)))
(let ((array (make-vector 4)))
(let ((index 2))
(subvector-move-left! input 0 index array (+ 0 0))
(vector-set! array (+ 0 index) 2)
(let ((skew (1+ 0)))
(let ((.index.1-0 (vector-length input)))
(subvector-move-left! input index .index.1-0 array (+ index
skew))
array))))))
In 10.1, evaluating the same form produces:
(lambda ()
(let ((input (vector 0 1 3)))
(let ((array (make-vector 4)))
(let ((index 2))
(subvector-move-left! input 0 index array (+ 0 0))
(vector-set! array (+ 0 index) 2)
(let ((skew (|1+| 0)))
(let ((index (vector-length input)))
(subvector-move-left! input index index array (+ index skew))
array))))))
The inner use of the identifier index does not get renamed, which makes the
calculation fail.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55090>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Bug-mit-scheme] [bug #55090] 9.2 -> 10.1 breaks macro by skipping some variable renaming,
Arthur A. Gleckler <=