Subject: Re: R5RS vs. "In Scheme, everything is a pointer"
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 19 Sep 2001 02:21:35 GMT
Newsgroups: comp.lang.scheme
Message-ID: <9o8vff$kvu6e$1@fido.engr.sgi.com>
Barry Margolin  <barmar@genuity.net> wrote:
+---------------
| Actually, a more accurate name might be "everything except small integers
| is a pointer".  Fixnums are often the only data types that can be
| implemented as immediate data, and everything else has to be "boxed".
+---------------

Hah! Hardly. Try: character, booleans, the empty list, and numerous
non-standard but widely-implemented magic objects sych as #<void>,
#<undefined>, #<unbound>, and #<eof>. Some implementations even choose
to represent small *reals* as immediates!

+---------------
| But as I've said before, this is purely just an optimization.
+---------------

And the reverse is true, too. For example, in SIOD Scheme everything
*is* a pointer, even small ints. There, the efficiency optimization is
to cons up a range of small ints at startup (typically -100..500, or so)
and have the primitive arithmetic operators check for their results being
in that range [a quick check] and if so return the pointer to the pre-cons'd
one [also quick, if pointers to them are stored in a table].


-Rob

-----
Rob Warnock, 30-3-510		<rpw3@sgi.com>
SGI Network Engineering		<http://reality.sgi.com/rpw3/>
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA

[Note: aaanalyst@sgi.com and zedwatch@sgi.com aren't for humans ]