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!news2.near.net!news.mathworks.com!udel!gatech!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!lll-winken.llnl.gov!noc.near.net!inmet!dsd!bobduff
From: bobduff@dsd.camb.inmet.com (Bob Duff)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
Message-ID: <D0KDGE.31F@inmet.camb.inmet.com>
Sender: news@inmet.camb.inmet.com
Organization: Intermetrics, Inc.
References: <3bii2g$kn2@news.parc.xerox.com> <3bjfep$9ss@gamma.ois.com> <3bo43b$61v@news.parc.xerox.com> <hbakerD08qGF.4qM@netcom.com>
Date: Fri, 9 Dec 1994 22:07:25 GMT
Lines: 26
Xref: glinda.oz.cs.cmu.edu comp.lang.c:119985 comp.lang.c++:102422 comp.lang.lisp:15967 comp.lang.ada:24574

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.

- Bob

P.S. I've read quite a few of Henry's papers.  They really are quite
entertaining (especially the titles) and informative.
-- 
Bob Duff                                bobduff@inmet.com
Oak Tree Software, Inc.
Ada 9X Mapping/Revision Team (Intermetrics, Inc.)
