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-Thread: 103376,5c89acd494ea9116 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Self pointer in limited record Date: Thu, 13 Sep 2007 16:37:51 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1183577468.034566.57830@n60g2000hse.googlegroups.com> <1188578849.187422.280620@50g2000hsm.googlegroups.com> <9fy1xoukz1e3$.h574sqmiauri$.dlg@40tude.net> <1189441670.293887.176810@g4g2000hsf.googlegroups.com> <16dbv6ehzvw3q.1ccv5mc0b5a2m.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1189719299 28402 69.95.181.76 (13 Sep 2007 21:34:59 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 13 Sep 2007 21:34:59 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feed.ac-versailles.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail Xref: g2news2.google.com comp.lang.ada:1943 Date: 2007-09-13T16:37:51-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:16dbv6ehzvw3q.1ccv5mc0b5a2m.dlg@40tude.net... > On Wed, 12 Sep 2007 16:57:05 -0500, Randy Brukardt wrote: > > > "Dmitry A. Kazakov" wrote in message > > news:uffdiv96c9bc.6mn4qaig7owe.dlg@40tude.net... > > >> What happens when somebody would create some of these objects on the stack? > > > > Works fine -- that's the whole point of this design. When the objects get > > finalized, the Claw code for Finalize unlinks them from their parent's list > > of children (after destroying any children that they might have). No fuss, > > no muss, quite cheap to do, and no dangling pointers. > > But then storage management should be made elsewhere, I mean, if children > are only finalized but not deallocated. True. But it is best to let the user decide how to do storage management (it should be a separate choice from the ADT). If stack management will work for their application (as is does for most Claw programs), then why make them (or the runtime, for that matter) mess with something more complicated? And if they do need dynamic allocation, they're much more likely to have knowledge of how it should be accomplished than any generic ADT designer. (And, of course, the ADT can easily be combined with any one of the containers packages; we shouldn't be deciding that they need a list when they might really need a map.) > >> You argue for automatic collection, that is my point too. But I would go > >> further and hide target objects behind handles to. That would eliminate > >> "access." The language problem is though that there is no simple way to > >> delegate operations from handle to the target object. It requires a lot of > >> work. > > > > Not worth it, because you either lose extension or gain a second level of > > tagged types for no real benefit. > > One benefit is GC (thought reference counting, for example), another is an > ability to share object implementations (aliasing). Both add their problems > too, of course. (:-)) True enough. As noted above, I generally prefer to separate memory management/data structures from the ADT itself. Of course, the ADT has to do its own internal memory management as needed. > BTW, are you going to port Claw to X11 anytime? (In the recent time I > worked much with GTK+, what a mess!) We've thought about it some, but haven't had the customer that really wanted it. OTOH, I'm seriously looking at moving a lot of my work to Linux (have gotten disgusted with Microsoft DRM in the OS), so that could force some level of porting. (We've done a few pieces, like the sockets library, but that isn't really what needs to be done.) Randy.