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,56131a5c3acc678e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-05 00:39:16 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-atanamir.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Question about OO programming in Ada Date: Fri, 05 Dec 2003 09:43:18 +0100 Message-ID: References: <1792884.HtYz4Yv8lY@linux1.krischik.com> <1070466281.168920@master.nyc.kbcfp.com> <1070490862.478119@master.nyc.kbcfp.com> <2prtsvgmt5lt3u1ulb5dvh8ba5nulfl3l3@4ax.com> NNTP-Posting-Host: tar-atanamir.cbb-automation.de (212.79.194.116) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1070613554 72361625 212.79.194.116 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:3146 Date: 2003-12-05T09:43:18+01:00 List-Id: On Thu, 04 Dec 2003 16:32:17 -0500, "Robert I. Eachus" wrote: >Dmitry A. Kazakov wrote: >> On Wed, 03 Dec 2003 20:23:53 -0500, "Robert I. Eachus" >> wrote: > > This would > > not be necessary if finalization of the type Pointer called > > deallocator in addition to a call to Finalize. > >Think about this for a second, because there is a germ of a good idea >here. For access types for which assignment is valid, such a rule would >be a disaster. For example you don't want the next record in a linked >list, and for that matter all of the rest of the list, deallocated if >you remove an item from a list. This actually is an argument against controlled-ness. I see little sense in taking any actions upon access type finalization. This rule imposes a non-zero run-time burden with practically zero gain. >However, in my example above, the >Object_Ref type is declared as limited. What if we had true limited >access types? > >type Pointer is limited access Object; > >For such a type deallocating the designated memory when the Pointer >object goes away would make sense. I just don't think it is a necessary >language extension since it is so easy to create the abstraction when >needed. (And besides, there are many cases where you want the type to >appear limited to users, but where you actually want to do assignment in >the package body.) I think that a real solution is to provide proper construction / destruction for *all* types. Should we have it, then the problem could be reduced to developing constructors / destructor of a given access type. This would allow a user to create any sort of garbage collection scheme he wants, instead of forcing compiler vendors to implement more and more sophisticated constructions. -- Regards, Dmitry Kazakov http://www.dmitry-kazakov.de