Path: utzoo!attcan!uunet!mcsun!ukc!cam-cl!scc From: scc@cl.cam.ac.uk (Stephen Crawley) Newsgroups: comp.sw.components Subject: Re: Real-time Garbage Collection Message-ID: <902@scaup.cl.cam.ac.uk> Date: 21 Sep 89 01:52:38 GMT References: <1917@hydra.gatech.EDU> <6506@hubcap.clemson.edu> Sender: news@cl.cam.ac.uk Organization: U of Cambridge Comp Lab, UK Lines: 39 Bill Wolfe writes: > OK, first let me clarify my position. The primary use for pointers > is simply to implement abstract data types -- lists, trees, graphs, etc.; > by shielding the user from the details of implementation, we can keep > the user from having to worry about manipulating pointers. Frankly, I can't see how this is possible. Suppose I have an ADT 'A' that has a generator operation NEW and a destructor function DISPOSE. Suppose I want a generic ADT LIST[t: type] that can be used in the following way. a: A aa: A while true do a := A$NEW(...) aa := A$NEW(...) l: LIST[A] := LIST[A]$MAKE_EMPTY() LIST[A]$INSERT(l, a) LIST[A]$INSERT(l, A$NEW(...)) LIST[A]$INSERT(l, a) aa := LIST[A]$REMOVE_HEAD(l) etc end while The generation of instances of A must be under the control of the application and assignment of A must be handled. I must be able to put an A instance into a list any number of times. How do I implement the LIST ADT so that it invokes the A$DISPOSE operation at the right time? When is the right time? What happens if I want to put an instance of A into 2 LIST's at the same time?