[racket-dev] Constructing an identifier to an unexported binding

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Thu May 23 09:08:44 EDT 2013

There are several identifiers that get introduced via expansion that TR needs to give types to. Not all are exported. Sam probably knows the reasons why they are not. I had to use the same code when concocting an analysis of racket core forms.
----- Original Message -----
From: Matthias Felleisen <matthias at ccs.neu.edu>
To: Eric Dobson <eric.n.dobson at gmail.com>
Cc: dev <dev at racket-lang.org>
Sent: Thu, 23 May 2013 08:54:36 -0400 (EDT)
Subject: Re: [racket-dev] Constructing an identifier to an unexported binding

This has a scary feeling to it. 

Can you raise the level of discourse one level and perhaps figure out whether this is needed at all? I.e., find a different way to solve the problem? (What is the real problem?) 

On May 23, 2013, at 1:57 AM, Eric Dobson <eric.n.dobson at gmail.com> 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?
> _________________________
>  Racket Developers list:
>  http://lists.racket-lang.org/dev

  Racket Developers list:

Posted on the dev mailing list.