[plt-scheme] What's the best thing for a distinct handle?

From: Derick Eddington (derick.eddington at gmail.com)
Date: Mon Mar 19 01:17:40 EDT 2007

On Mon, 2007-03-19 at 13:06 +0800, Matthew Flatt wrote:
> At Sun, 18 Mar 2007 21:40:42 -0700, Derick Eddington wrote:
> > I'm using distinct values, compared using eq?, as handles (because
> > they're unforgable and I can control who gets them).  I'm wondering what
> > is the best type of MzScheme value to use for this.  I figure whatever
> > would use the least memory is the best, so what type of MzScheme value,
> > that can be used for this, uses the least memory?  A box of `null'?  A
> > new empty string?  A new empty vector?
> A box containing `null' would be the smallest, as far as I can tell.
> I usually use a gensym, because it seems cleanest, but that's not the
> smallest.
> A symbol with up to three ASCII characters, as produced by
> `string->uninterned-symbol', is the same size as a pair, and probably
> less work for the GC to manage than either a pair or a box (since a
> symbol is atomic). Using a symbol with particular characters also has
> the advantage that it's more recognizable if it somehow leaks.

Thanks for the info!

: Derick

Posted on the users mailing list.