Xref: utzoo comp.lang.c++:3047 comp.lang.lisp:1666 comp.lang.misc:2837 Path: utzoo!attcan!utgpu!watmath!watmsg!gjditchfield From: gjditchfield@watmsg.waterloo.edu (Glen Ditchfield) Newsgroups: comp.lang.c++,comp.lang.lisp,comp.lang.misc Subject: Re: C++ vs. Other OOLs Message-ID: <25399@watmath.waterloo.edu> Date: 20 Apr 89 13:53:46 GMT References: <2602@ssc-vax.UUCP> <5947@pdn.paradyne.com> <38836@bbn.COM> <15425@bellcore.bellcore.com> Sender: daemon@watmath.waterloo.edu Reply-To: gjditchfield@watmsg.waterloo.edu (Glen Ditchfield) Organization: U. of Waterloo, Ontario Lines: 25 In article <15425@bellcore.bellcore.com> sjs@ctt.bellcore.com (Stan Switzer) writes: >Adding garbage collection to C++, though, probably does more harm than >good. I do not see how to square garbage collection with the notion >of destructors, for instance. Remember, destructors aren't just for >memory management: a "window" destructor might "unmap" the window and >propogate "repaint" messages to previously obscured windows. I'd square garbage collection and destructors by having the collector invoke an object's destructor when it reclaims the object's storage. Perhaps destructors can help the collector out by breaking pointer cycles and setting pointers in the object's implementation to nil. Dr. Stroustrup's "Possible Directions for C++" paper in the 1987 Usenix C++ Workshop Proceedings distinguishes "primary objects", which should be garbage-collected, and "secondary objects", which are part of the imple- mentation of some other object and which can be easily managed by the other object's constructors and destructor. This is another way to reduce the cost of garbage collection. The paper mentions Jonathan Shopiro's "counted pointer" classes, which provide garbage collection for C++. Unfortunately the reference given is for a then-unwritten paper. Is there a better reference or a publically available implementation? Glen Ditchfield gjditchfield@violet.uwaterloo.ca Office: DC 2517 Dept. of Computer Science, U of Waterloo, Waterloo, Ontario, Canada, N2L 3G1 "... and the rest, we will spend foolishly!" -- _Svengali_