[racket-dev] set!-transformers and syntax-local-value/immediate

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri May 17 19:30:35 EDT 2013

Hi all,

I'm confused about an aspect of set! and rename transformers. I'll
explain with this example:

  #lang racket

  ;; a macro that uses `syntax-local-value/immediate`
  (define-syntax (lookup stx)
    (syntax-case stx ()
      [(_ id)
       (let-values ([(f _) (syntax-local-value/immediate #'id)])
         (displayln (rename-transformer? f))
         (displayln (set!-transformer? f))
         #'0)]))

  ;; f is a set!-transformer
  (let-syntax ([f (make-set!-transformer values)])
    (lookup f))

  ;; sanity check
  (rename-transformer? (make-set!-transformer values))

In this example, `f` is bound to a set!-transformer. The macro `lookup`
will look up the value bound to `f` at compile-time, and I expected that
the result would be the set! transformer.

However, it seems like the set! transformer is somehow being turned into
a rename transformer (note the two print statements produce #t and #f
respectively). The last line suggests that set! transformers are not
actually a "subtype" of rename transformers though.

Am I confused about set! transformers or is there a bug here?

Cheers,
Asumu

Posted on the dev mailing list.