[racket-dev] Uninterned symbols in compiled code

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Fri Jul 6 13:12:04 EDT 2012

The documentation for generate-temporaries[1] ends with, "The
generated identifiers are built with interned symbols (not gensyms),
so the limitations described with current-compile do not apply."
However, I cannot find any limitations described in the documentation
for current-compile[2].  If I follow a link there to documentation on
printing compiled code[3], I find the following paragraph:

"A compiled-form object may contain uninterned symbols (see Symbols)
that were created by gensym or string->uninterned-symbol. When the
compiled object is read via #~, each uninterned symbol in the original
form is mapped to a new uninterned symbol, where multiple instances of
a single symbol are consistently mapped to the same new symbol. The
original and new symbols have the same printed representation.
Unreadable symbols, which are typically generated indirectly during
expansion and compilation, are saved and restored consistently through
#~."

I'm unsure whether this corresponds to the limitations that
generate-temporaries refers to.  This certainly looks to me like it
does "the right thing" with uninterned symbols in compiled code, but
I'm probably ignoring an important subtlety.  Can someone please
clarify this issue, here and/or in the documentation?  An example of
the kind of problem that arises when using gensym in compiled code
would be wonderful.

Carl Eastlund

[1] http://docs.racket-lang.org/reference/stxops.html#%28def._%28%28lib._racket/private/stxcase-scheme..rkt%29._generate-temporaries%29%29

[2] http://docs.racket-lang.org/reference/eval.html#%28def._%28%28quote._~23~25kernel%29._current-compile%29%29

[3] http://docs.racket-lang.org/reference/printing.html#%28part._print-compiled%29

Posted on the dev mailing list.