Newsgroups: alt.lang.design,comp.lang.c,comp.lang.c++,comp.lang.lisp,comp.lang.ada
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!gumby!newsxfer.itd.umich.edu!gatech!howland.reston.ans.net!agate!darkstar.UCSC.EDU!news.hal.COM!decwrl!netcomsv!netcom.com!hbaker
From: hbaker@netcom.com (Henry G. Baker)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
Message-ID: <hbakerD0rBox.6IG@netcom.com>
Organization: nil
References: <3bo43b$61v@news.parc.xerox.com> <hbakerD08qGF.4qM@netcom.com> <D0KDGE.31F@inmet.camb.inmet.com>
Date: Tue, 13 Dec 1994 16:12:33 GMT
Lines: 41
Xref: glinda.oz.cs.cmu.edu comp.lang.c:120394 comp.lang.c++:102843 comp.lang.lisp:16028 comp.lang.ada:24673

In article <D0KDGE.31F@inmet.camb.inmet.com> bobduff@dsd.camb.inmet.com (Bob Duff) writes:
>In article <hbakerD08qGF.4qM@netcom.com>,
>Henry G. Baker <hbaker@netcom.com> wrote:
>>I just wanted to point out again that objects whose reference counts
>>are always one, and the programmer/compiler knows this, avoid the
>>usual overheads of reference counting.
>
>But it seems to me that in a language like Ada, if a given object only
>has one reference pointing to it, and that fact is known at compile
>time, then you would almost always declare that object as a normal
>stack-allocated object.  So it would not be in the heap in the first
>place, so reference counting would never occur.
>
>In other words, the optimization you mention seems useful in a language
>like Lisp, where everything's a pointer, but it seems irrelevant to Ada.
>Or, to put it differently, Ada compiler's already do this optimization
>-- the way you invoke it is to use an object instead of a
>pointer-to-object.

This optimization is quite useful in Ada -- perhaps more useful than
in Lisp because of the existence of multiple threads/tasks.  Whereas
stack-allocated objects are constrained by LIFO behavior, the objects
I describe have no such constraints.  Secondly, and probably much more
important in Ada, is the fact that an object whose reference count is
exactly one can be referenced by only one task/thread, and therefore
need _not_ be protected by a semaphore or protected record.

Therefore, these objects are ideal objects to be sent in messages
from one task/thread to another.

(I didn't come up with this stuff, but I highly recommend it.  The
"NIL" and "Hermes" languages for distributed computations out of IBM
Yorktown deal nearly exclusively with singly-referenced objects of
this sort.)

Henry Baker
Read (192.100.81.1) ftp.netcom.com:/pub/hb/hbaker/README for ftp-able papers.
WWW archive: ftp://ftp.netcom.com/pub/hb/hbaker/home.html
************* Note change of address ^^^        ^^^^
(It _is_ accessible, but Netcom is loaded; keep trying.)

