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,147f221051e5a63d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: memory management in Ada: tedious without GC? Date: Fri, 16 May 2008 18:05:24 -0500 Organization: Jacob's private Usenet server Message-ID: References: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> <9f2c2db4-d6c1-4cdf-884c-5cbc26ac7701@d1g2000hsg.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1210979155 16377 69.95.181.76 (16 May 2008 23:05:55 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 16 May 2008 23:05:55 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-RFC2646: Format=Flowed; Original Xref: g2news1.google.com comp.lang.ada:130 Date: 2008-05-16T18:05:24-05:00 List-Id: "Maciej Sobczak" wrote in message news:9f2c2db4-d6c1-4cdf-884c-5cbc26ac7701@d1g2000hsg.googlegroups.com... ... > 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, which is a big issue > with the lack of multiple inheritance (controlled streams, anyone?) - ... I understand your point, but I think it is wrong. That's because I think all new tagged types should be controlled types (even if you are not using the functionality now). If you have a non-formal parameter type "type T is tagged..." you are guilty of premature optimization. (Yes, I can imagine that there exist cases where the overhead is too much, but I think you need to prove that in practice before worrying about -- it surely is possible for compilers to eliminate the overhead of unused initialization/finalization, and most do to some degree.) If you get stuck with badly designed existing types, you can wrap the new stuff in a controlled type and get the correct behavior (as someone else suggested). (It's very rare that implementation inheritance buys you anything anyway.) Randy.