[racket] Interned and uninterned symbols

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Aug 16 19:42:46 EDT 2011

Two normal symbols are equal if only if they are spelled the same.
A normal implementation of symbols will keep a hash table of all
used symbols. Each time 'foo is found in the source the same
symbol will be returned. Thus two symbols can be compared
with eq? (think: simple pointer comparison).

Now imagine that you want to generate a unique symbol.
One could try to use (string->symbol "a very unsusal name")
but if you are *really* unlucky, someone might have used
the same symbol name some where else in an obscure
linbrary - and if he did the name won't be unique.

Thus string->uninterned-symbol can be thought of as
"generate a symbol, but don't put it in the global hash
table of symbols". More abstractly: "Generate a unique

Jens Axel Søgaard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110817/6d34e612/attachment.html>

Posted on the users mailing list.