Article View: comp.lang.misc
Article #2001Re: Some things that pointer-less languages can't do efficiently
From: Barry Margolin
Date: Fri, 09 Nov 1990 18:30
Date: Fri, 09 Nov 1990 18:30
31 lines
2040 bytes
2040 bytes
In article <HEZ6WP9@xds13.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes:
>In article <3716@skye.ed.ac.uk> jeff@aiai.UUCP (Jeff Dalton) writes:
>> You can't have a pointer to the cdr of a list...
>(setq a '(foo (bar baz)))
>(setq b (cdr a))
>(rplaca b 'bog)
I think what he meant was that you can't set the CDR of A's value without
having a pointer to the whole cons. Lisp "pointers" always point to the
beginning of some (possibly composite) object. If there were true
pointers, then instead of distinct RPLACA and RPLACD operations there could
be a RPLAC operation whose argument is a pointer to the specific cell.
Conses are like magnets -- there's no Lisp monopole!
A better example might have been that you can't have a pointer to a
symbol's value cell, or to a particular cell of an array.
By the way, Zetalisp (and its descendent, Symbolics Common Lisp) *does*
have pointers, called locatives. They are used for implementation of many
of the Lisp primitives that aren't implemented in hardware or microcode,
but also in the internals of and interfaces to many OS routines for
efficiency (locatives are implemented as an immediate data type, so they
don't take up space or invoke the memory allocator). Locatives just
contain machine addresses, like conventional machine pointers, but they are
updated when the referenced object is moved by the garbage collector.
--
Barry Margolin, Thinking Machines Corp.
barmar@think.com
{uunet,harvard}!think!barmar
Technical Details
Message-ID:
<1990Nov9.183037.21322@Think.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!barmarReferences:
<3975@goanna.cs.rmit.oz.au> <3716@skye.ed.ac.uk> <HEZ6WP9@xds13.ferranti.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.misc Subject: Re: Some things that pointer-less languages can't do efficiently Message-ID: <1990Nov9.183037.21322@Think.COM> Date: 9 Nov 90 18:30:37 GMT References: <3975@goanna.cs.rmit.oz.au> <3716@skye.ed.ac.uk> <HEZ6WP9@xds13.ferranti.com> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 31