Newsgroups: alt.lang.design,comp.lang.c,comp.lang.c++,comp.lang.lisp
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: <hbakerD042BB.5p3@netcom.com>
Organization: nil
References: <3bdd2v$ckg@larry.rice.edu> <3bgbv6$qmo@network.ucsd.edu> <D03Iwn.Jn5@research.att.com>
Date: Thu, 1 Dec 1994 02:45:10 GMT
Lines: 33
Xref: glinda.oz.cs.cmu.edu comp.lang.c:118611 comp.lang.c++:101132 comp.lang.lisp:15877

In article <D03Iwn.Jn5@research.att.com> ark@research.att.com (Andrew Koenig) writes:
>Consider, for example, an interpreter that uses two associative
>data structures.  One maps identifiers to magic cookies that
>represent memory locations; the other maps those locations to
>the corresponding values.  This two-level approach, or something
>like it, is needed if the interpreter is to handle lexical
          ^^^^^^^^^
>scoping correctly.

It is?  Lisp interpreters handling lexical scoping correctly have
avoided this problem for ages.  Furthermore, the solution (closures)
is completely independent of whether the interpreter uses lexical or
dynamic scoping.  Finally, shallow binding can be used even in
lexically-scoped environments and avoid the problems of uncollectable
stuff.  See my papers re "shallow binding" in my ftp/www directory.
(This is really _old_ (1978) stuff; have textbooks really dropped the
ball this badly?)

>Suppose that during execution, the value of one of these
>cookies becomes unnecessary.  How does the interpreter know
>that it can delete the corresponding entry from the second
>associative data structure?  Or can it?

This problem of collecting caches and other associative data
structures is the basis for the introduction of 'weak pointers' into
garbage collection systems.  There's a rather large literature on both
the problem and on various solutions for it.  See Paul Wilson's
ftp archive of GC papers for pointers.

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 ^^^        ^^^^
