From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!cornell!uw-beaver!uw-june!klaiber From: klaiber@june.cs.washington.edu (Alexander Klaiber) Newsgroups: comp.lang.ada Subject: Re: Garbage Collection Message-ID: <6713@june.cs.washington.edu> Date: 13 Dec 88 23:36:44 GMT References: <6702@june.cs.washington.edu> <3861@hubcap.UUCP> Reply-To: klaiber@uw-june.UUCP (Alexander Klaiber) Organization: U of Washington, Computer Science, Seattle List-Id: In article <8812131536.AA08238@galaxy.compass.com> worley@compass.UUCP (Dale Worley) writes: >I will add that garbage collection is one of the greatest aids to >readabilty and reliability, because it takes a complicated and >error-prone part of programming (reclaiming storage) and eliminates it >completely. It probably shouldn't be required in Ada, but as an aid >in programmability, it's great. Thank you very much, exactly my point. At least I'm not alone :-) ========================================================================== In article <3861@hubcap.UUCP> wtwolfe@hubcap.clemson.edu writes: > No, this isn't structural sharing, because you are explicitly manipulating Call it what you want, the fact is that multiple references exist to one object, thus making explicit (i.e. by the programmer) storage management a nightmare and an unnecessary chore. GC deals with this situation easily. > In this particular instance, it would be best to store the key by which > a person could be identified (social security number, for example) in > the list, and then using the key to retrieve the current address from > the Person database. That is, if you are willing to willing to pay the cost for the additional data base lookup (usually an O(log n) operation), as well as the additional complexity introduced in your program. I didn't say it couldn't be done without (what I call) structure sharing, I just wanted to point out that this would be a very intuitive approach and would probably lead to a very readable code. The method of using key searches is, I believe, an unnecessary hack to avoid multiple references. Why bother to include a full B-tree package or such when we can do without? Clearly, there is a tradeoff between readability and efficiency. In my version, I reduce efficiency by requiring garbage collection (although there exist rather powerful and fast GC algorithms). Your proposal would definitely increase the complexity of the program and, due to the overhead of a DB-lookup, might actually run slower than the version with GC --- depending on circumstances such as frequency of lookups in the database, size of the database (your program) vs. time required for GC, amount of garbage produced etc. (my program). In my opinion, people tend to put too much emphasis on plain efficiency of their programs and too little on issues such as readability, reliability and extensibility --- and I contend that (depending on the application) garbage collection *CAN* help to improve all of these. Hence, it is *wrong* to flatly ignore GC; it sure has its place and, especially in o-o systems, should be available as an option to the programmer. Now whether it should be required in *Ada* is a question of just where Ada9x will go and not really my concern. Alexander Klaiber klaiber@june.cs.washington.edu