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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd63afa4dc364b7e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-16 13:31:11 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!209.50.235.254!europa.netcrusader.net!208.184.7.66!newsfeed.skycache.com!Cidera!news-reader.ntrnet.net!uunet!ash.uu.net!world!bobduff From: Robert A Duff Subject: Re: Better support for garbage collection Sender: bobduff@world.std.com (Robert A Duff) Message-ID: Date: Fri, 16 Mar 2001 16:42:55 GMT References: <98m938$2iod0$1@ID-25716.news.dfncis.de> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: supernews.google.com comp.lang.ada:5754 Date: 2001-03-16T16:42:55+00:00 List-Id: Brian Rogoff writes: > IMO, just tacking on GC to an existing language doesn't make it very > much better. I think it does. But anyway, Ada was originally designed with GC in mind -- the original intent was that all implementations would of course support GC. But they didn't. So implementing a GC for Ada isn't "tacking on" in the language design sense. Note that Unchecked_Deallocation is hidden away in chapter 13, and given a jaw-breaking name -- if Ichbiah had wanted everybody to use it, wouldn't he have called it "dispose" or "free", and made it a built-in operation of some sort (like "new")? >... When the language designers design a language with the > expectation of GC, they may then support some higher level features, > like first class functions, which do make the language much better. I don't see the huge advantage of first class functions. I *do* see the advantage of downward closures. Whenever I have asked for examples showing the usefulness of full closures, most folks produce examples of downward closures. (I've had this argument here, and also on functional language newsgroups, where you would expect to find more knowledge about closures.) I also see a *disadvantage* of full closures: Information that is local to a procedure can "escape", which seems to make code harder to understand. It seems to me that if you want to pass a function (plus its environment) outward, you should instead explicitly create a tagged object on the heap, to make it clear that this thing survives after the end of the current procedure. In any case, surely GC is useful independent of closures: it can go a long way toward getting rid of dangling pointer bugs and storage leak bugs. > Ada is far less leaky than C family languages, so the win of just > adding a GC seems smaller for Ada. I would say "somewhat less leaky". > Of course, you still have designers who blow it by putting in GC and > omitting such features, but then after a few years they realize they > screwed up and hack in such things. Java and Eiffel are good examples > of such screw ups (nested/anonymous classes and "agents"). Tell us about the Eiffel case. The version of Eiffel I know had no such thing. > > It is also possible to use Boehm's conservative collector with Ada. > > Does anybody do so? > > > > (I find the idea of conservative collection somewhat distasteful, > > but it does seem to work in many cases.) > > Maybe if it were called a "probabilistic garbage collector" you wouldn't > mind? ;-) ;-) > Didn't Norman Cohen have a proposal for a storage pool extension that > provided some support for garbage collection? I thought so, but my neural > garbage collector seems to have reclaimed that hunk of my brain... I don't remember that. I do remember Norm participating in the above "are full closures useful" argument. He's the only one I recall who produced an example that wasn't "downward". I was only half convinced by his example. - Bob