🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2242

Re: Some things that pointer-less languages can't do efficiently

#2242
From: Barry Margolin
Date: Tue, 27 Nov 1990 17:42
43 lines
2450 bytes
In article <5P57P18@xds13.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes:
>In article <3808@skye.ed.ac.uk> jeff@aiai.UUCP (Jeff Dalton) writes:
>> What you can't do is:
>
>>   (setq a '(some list))
>>   (setq b (pointer-to (cdr a)))
>
>But "a" is already a "pointer" to "cdr a". In this case the "reference"
>operation is simply "cdr".
>
>You want to factor the pointer out of the cons. I don't care if you can
>or not: the cons already has the same semantics as a pair of pointers, and
>everything that can be said "about" pointers can be said "about" a cons.

But if you had a function that expected one pointer, you can't pass it a
cons, because that is two pointers.

Also, assuming that you define conses as pointers to one of their cells
(Maclisp/Zetalisp "disembodied" property lists do precisely this,
arbitrarily defining a cons as a pointer to its cdr, with the car being
ignored -- this heritage resulted in Lisp Machines using CDR as their
locative dereferencing instruction, so conses may still be used in place of
locative pointers), then what about

(setq c (pointer-to (symbol-value 'a)))
(setq d (pointer-to (symbol-plist 'a)))
(setq e (pointer-to (symbol-function 'a)))

?  You could define a symbol as a pointer to one of its cells, but it can't
"point" to all of them.

[BTW, I don't think the Maclisp use of the cdr as the disembodied property
list dereference was totally arbitrary.  I think the layout of symbols and
conses was such that the instruction that implements CDR of a cons happens
also to implement PLIST of a symbol.  This allows GET, PUTPROP, etc.
operate on both symbols and disembodied plists without a runtime type
check.  This may not have been accidental, though, as this is true in both
PDP-10 and Multics Maclisp.]
--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar
Technical Details
Message-ID: <1990Nov27.174240.18719@Think.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!princeton!udel!wuarchive!zaphod.mps.ohio-state.edu!think.com!barmar
References: <HEZ6WP9@xds13.ferranti.com> <3808@skye.ed.ac.uk> <5P57P18@xds13.ferranti.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!princeton!udel!wuarchive!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: <1990Nov27.174240.18719@Think.COM>
Date: 27 Nov 90 17:42:40 GMT
References: <HEZ6WP9@xds13.ferranti.com> <3808@skye.ed.ac.uk> <5P57P18@xds13.ferranti.com>
Sender: news@Think.COM
Organization: Thinking Machines Corporation, Cambridge MA, USA
Lines: 43