On 05/23/2013 01:57 AM, Eric Dobson wrote:
Some modules have macros which expand into identifiers that are not
exported, as they want to protect those bindings. TR currently has the
following code which allows it to generate an identifier which is
free-identifier=? to what would appear in the output of the macros.

define (make-template-identifier what where)
   (let ([name (module-path-index-resolve (module-path-index-join where #f))])
     (parameterize ([current-namespace (make-empty-namespace)])
       (namespace-attach-module (current-namespace) ''#%kernel)
       (parameterize ([current-module-declare-name name])
         (eval `(,#'module any '#%kernel
                  (#%provide ,what)
                  (define-values (,what) #f))))
       (namespace-require `(for-template ,name))
       (namespace-syntax-introduce (datum->syntax #f what)))))

This turns out to be a slightly slow part of the initialization of TR.
Does anyone know another way to get such an identifier?

There's another way around this issue, which is to avoid creating these identifiers at all. In other words, change the representation of the type environment to something that supports symbol+module pairs as keys in addition to identifiers. The easiest way to do that is to add in a hash table behind the current free-id-table, since the two tables would handle disjoint sets of identifiers.

Ryan

_________________________
 Racket Developers list:
 http://lists.racket-lang.org/dev

Reply via email to