Newsgroups: alt.lang.design,comp.lang.c,comp.lang.c++,comp.lang.lisp,zer.z-netz.sprachen.algorithmen
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!ix.netcom.com!netcom.com!hbaker
From: hbaker@netcom.com (Henry G. Baker)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
Message-ID: <hbakerCzowoI.3B@netcom.com>
Organization: nil
References: <AST.178.785265972@postman.hsn.no>> <TFB.94Nov21091959@burns.cogsci.ed.ac.uk> <3atfkd$8hl@news.parc.xerox.com>
Date: Tue, 22 Nov 1994 22:19:30 GMT
Lines: 27
Xref: glinda.oz.cs.cmu.edu comp.lang.c:117534 comp.lang.c++:99959 comp.lang.lisp:15765

In article <3atfkd$8hl@news.parc.xerox.com> boehm@parc.xerox.com (Hans Boehm) writes:
>In general, my experience with primarily imperative languages, and
>especially C, is that cycles are extremely common, are often created
>accidentally (e.g. the back edge is the link in a hash table chain),
>and that there is no good methodology for avoiding them in a large project
>that is not completely understood by a single person.  There are no doubt
>programming styles that can improve matters, but I think they're
>significantly different from normal C/C++ styles.

I would agree with Hans, in general, with respect to currrent C/C++
styles.  I would like to point out that there are 2 styles of
programming that I can think of that cannot create cycles.  The first
is pure functional programming, in which a newly created object can
only point to older objects; QED.  (Watch out for recursive functional
closures; use the 'Y' combinator instead.)  The second is 'linear'
style programming, where all objects have reference counts =1.  Since
an accessible cycle requires at least one ref count >1, this cannot
happen.  Avoiding cyclic garbage then requires mild restrictions on
the primitives.  (See Suzuki's 1982 CACM article on pointer
permutations.)  QED

The linear style is discussed in a number of articles in my ftp
archive.

Henry Baker
Read (192.100.81.1) ftp.netcom.com:/pub/hbaker/README for ftp-able papers.
WWW archive: ftp://ftp.netcom.com/pub/hbaker/home-page.html
