[racket-dev] Uninterned symbols in compiled code
At Fri, 6 Jul 2012 12:59:34 -0600, Matthew Flatt wrote:
> As I try to make an example illustrating problems, I see that Racket is
> more resistant to problems created by `gensym' than I expected.
Ah --- one more level of indirection demonstrates the sort of trouble
that I expected. If you compile only "a.rkt" and "b.rkt" below with
`raco make b.rkt', then `racket c.rkt' doesn't work.
a.rkt
-----
#lang racket
(define-syntax (define-maker stx)
(syntax-case stx ()
[(_ id)
(with-syntax ([ga (datum->syntax stx (gensym 'a))])
#'(begin
(define ga (random))
(define-syntax-rule (id new-id)
(define-syntax-rule (new-id)
ga))))]))
(define-maker a)
(provide a)
b.rkt
-----
#lang racket/base
(require "a.rkt")
(a b)
(provide b)
c.rkt
-----
#lang racket/base
(require "b.rkt")
(b)