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 Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.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="iso-8859-1" Content-Transfer-Encoding: 8bit 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> Date: Mon, 19 May 2008 09:55:08 +0200 Message-ID: <1qxcw3pphdlek.1jgsfwb7atdmo.dlg@40tude.net> NNTP-Posting-Date: 19 May 2008 09:55:08 CEST NNTP-Posting-Host: 6d8e645e.newsspool2.arcor-online.net X-Trace: DXC=MTTQTBEX:C;NTD55K=A9EHlD;3Yc24Fo<]lROoR18kF7enW;^6ZC`4IXm65S@:3>?PHN2_[=?bP> X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:222 Date: 2008-05-19T09:55:08+02:00 List-Id: On Sun, 18 May 2008 20:50:48 -0700 (PDT), Matthew Heaney wrote: > On May 16, 4:42�pm, Maciej Sobczak wrote: >> >> In Ada RAII is realized with controlled types. They are severely >> broken in that they are intrusive in the type hierarchy and they burn >> the whole budget for implementation inheritance, > > No, this is wrong. You can add in Controlled-ness as far down the > hierarchy as you like, by adding a controlled component. This is broken too: 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. 2. Similarly, Initialize might be called before the container object is fully operational. 3. Access discriminant would require controlled object to become limited, so must be the container. 4. The pattern is exposed to multiple inheritance diamond diagram problem, when such components are added independently. > Furthermore, if you blow your budget in Ada, then you blow in C++ too, > since invoking Finalization in Ada is the same as invoking a dtor in C+ Well, I suggest that the overhead required in C++ for maintenance virtual destructors should be lower than one Ada.Finalization. For example it does not require linked list of objects. IMO, initialization/finalization hooks shall be definable for all types. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de