<div dir="ltr"><div><div>Asumu,<br><br></div><div>Your lookup macro's output just tells whether there is a rename somewhere between the binding for f and its original source binding. Rename transformers get injected all over the place. To get the real story, turn your lookup macro into a loop that chases the binding back to the source. Or, use the macro stepper with hiding off. The let-syntax expression expands into:<br>
</div><br> (letrec-syntaxes+values (((f1) (make-set!-transformer values))) ()<br> (letrec-syntaxes+values (((f) (values (make-rename-transformer (quote-syntax f1))))) ()<br> (lookup f)))<br><br>
</div>That's where the rename comes from.<br><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><div class="gmail_quote">On Fri, May 17, 2013 at 7:30 PM, Asumu Takikawa <span dir="ltr"><<a href="mailto:asumu@ccs.neu.edu" target="_blank">asumu@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
I'm confused about an aspect of set! and rename transformers. I'll<br>
explain with this example:<br>
<br>
#lang racket<br>
<br>
;; a macro that uses `syntax-local-value/immediate`<br>
(define-syntax (lookup stx)<br>
(syntax-case stx ()<br>
[(_ id)<br>
(let-values ([(f _) (syntax-local-value/immediate #'id)])<br>
(displayln (rename-transformer? f))<br>
(displayln (set!-transformer? f))<br>
#'0)]))<br>
<br>
;; f is a set!-transformer<br>
(let-syntax ([f (make-set!-transformer values)])<br>
(lookup f))<br>
<br>
;; sanity check<br>
(rename-transformer? (make-set!-transformer values))<br>
<br>
In this example, `f` is bound to a set!-transformer. The macro `lookup`<br>
will look up the value bound to `f` at compile-time, and I expected that<br>
the result would be the set! transformer.<br>
<br>
However, it seems like the set! transformer is somehow being turned into<br>
a rename transformer (note the two print statements produce #t and #f<br>
respectively). The last line suggests that set! transformers are not<br>
actually a "subtype" of rename transformers though.<br>
<br>
Am I confused about set! transformers or is there a bug here?<br>
<br>
Cheers,<br>
Asumu<br>
_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
<br>
</blockquote></div><br></div></div>