[plt-scheme] immutable strings vs. uninterned symbols

From: Doug Orleans (dougorleans at gmail.com)
Date: Tue Jun 6 18:32:17 EDT 2006

Doug Orleans writes:
 > (Are there other differences?  Garbage collection maybe?)

The MzScheme manual says that interned symbols are only weakly held by
the internal symbol table, which seems to imply that uninterned
symbols are never garbage collected.  But it looks like this is not
the case:

> (define ht (make-hash-table 'weak))
> (hash-table-put! ht (string->uninterned-symbol "foo") 23)
> (hash-table-count ht)
1
> (hash-table-put! ht 'bar 42)
> (hash-table-count ht)
2
> (collect-garbage)
> (hash-table-count ht)
0

Or maybe I'm reading too much into that sentence...

--dougorleans at gmail.com


Posted on the users mailing list.