chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-janitors] #1362: A case when composing with ir-macro-transf


From: Chicken Trac
Subject: Re: [Chicken-janitors] #1362: A case when composing with ir-macro-transformer
Date: Fri, 14 Apr 2017 16:04:14 -0000

#1362: A case when composing with ir-macro-transformer
---------------------------------+---------------------------------
            Reporter:  megane    |      Owner:
                Type:  defect    |     Status:  new
            Priority:  major     |  Milestone:  4.13.0
           Component:  expander  |    Version:  4.12.0
          Resolution:            |   Keywords:  ir-macro-trasformer
Estimated difficulty:  hard      |
---------------------------------+---------------------------------

Comment (by sjamaan):

 Essentially, the bug is this:

 {{{#!scheme
 (define-syntax wrapper/do-nothing
   (er-macro-transformer
    (lambda (e r c)
      (let* ((%x (r 'x))
             (%%x (r %x)))
        `(let ((,%x 1)
               (,%%x 2)) ;; Twice the rename, twice the regret
           ,(cadr e))))))

 (define x 1)

 (display (wrapper/do-nothing x)) ;; Should print 1, but prints 2
 (newline)
 }}}

 That's because {{{ir-macro-transformer}}} will rename the entire input
 form, which may contain identifiers which already have been renamed by
 another macro, resulting in an "undo" of the renaming of those double-
 renamed identifiers.

 You can test the above snippet in Chibi, MIT Scheme or Scheme48 (remove
 the {{{er-macro-transformer}}} wrapper from the lambda to test it in the
 latter), they all print 1.  I've sent a patch to chicken-hackers which
 fixes this.

--
Ticket URL: <https://bugs.call-cc.org/ticket/1362#comment:2>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]