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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,147f221051e5a63d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!news.doubleslash.org!open-news-network.org!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: memory management in Ada: tedious without GC? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> <9f2c2db4-d6c1-4cdf-884c-5cbc26ac7701@d1g2000hsg.googlegroups.com> <1qxcw3pphdlek.1jgsfwb7atdmo.dlg@40tude.net> Date: Sat, 24 May 2008 10:25:33 +0200 Message-ID: <10j4zhb9ge8ea.156spz1dkc4vb$.dlg@40tude.net> NNTP-Posting-Date: 24 May 2008 10:25:34 CEST NNTP-Posting-Host: 1d12983a.newsspool4.arcor-online.net X-Trace: DXC=dMIET>CLCA\AX0F2i> On Fri, 23 May 2008 19:15:45 -0400, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> 1. You don't know exactly the order in which the Finalize of the controlled >> component gets called. So if you access the container object over an >> access discriminant, that might be already invalid. > > You know something about the order. Initialize is bottom-up, > Finalize is top-down. And when there are access discrims, the > order among subling-components is specified by the RM. > > I would prefer a fully defined order, based on the declaration order. Hmm, that would be even more broken, I think. The language should not require more than necessary to implement the programmer's intent. The order of record components or discriminants has no semantic meaning (except when representation clauses involved). The compiler should be able to re-order and even remove them, as well as initialization of. Consider a statically constrained discriminant as an example. If the compiler could remove it, we would have the problem of measurement units solved! >> 4. The pattern is exposed to multiple inheritance diamond diagram problem, >> when such components are added independently. > > I don't understand your point here. Could you give an example of the > problem? type A is limited tagged record ...; type B is new A with record -- a controlled component here to handle finalization of A generic type Some_A is new A with private; package P is type C is new Some_A with record -- a controlled component here to handle finalization of A Now, if P is instantiated with B, finalization of A will be handled twice. The problem is that finalization in C++ terms is a "virtual" member, while record components are "non-virtual". Implementation of one through another is IMO fundamentally broken. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de