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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f1111f1bf805022b X-Google-Attributes: gid103376,public From: "Robert I. Eachus" Subject: Re: Unconstrained type Unchecked_Deallocation Date: 2000/04/05 Message-ID: <38EBAAD6.3EA21F14@earthlink.net>#1/1 X-Deja-AN: 607246703 Content-Transfer-Encoding: 7bit References: <8a0h55$qc5$1@nnrp1.deja.com> <38C3D82F.C9F81832@bton.ac.uk> <38C566CE.6283C0AD@rational.com> <8a6f5s$5st$1@nnrp1.deja.com> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 954968683 63.24.56.57 (Wed, 05 Apr 2000 14:04:43 PDT) Organization: The MITRE Corporation MIME-Version: 1.0 NNTP-Posting-Date: Wed, 05 Apr 2000 14:04:43 PDT Newsgroups: comp.lang.ada Date: 2000-04-05T00:00:00+00:00 List-Id: Robert Dewar wrote: > > In article <38C566CE.6283C0AD@rational.com>, > Mark Lundquist wrote: > > > Right, hiding the instantiation of Unchecked_Deallocation is > > often a good idea. > > This is stated without justification. Please give your reasons > for this, I don't see it at all. There are occaisions where you may want in the future to change the management mechanism for some type, by a means other than using storage pools. However, in Ada 95 this seems like a long stretch. In any case, if the fact that a type is an access type is visible--as it has to be to do the instantiation, I don't see much reason to hide the deallocation operation. Unchecked_Conversion is a very different case. I think I invented the name "Unchecked Perversion" for visible instantiations of Unchecked_Conversion--it really is that bad. Putting an instance of Unchecked_Conversion substantially increases the coupling throughout a program with no corresponding benefit. As an example--and one I ran into often in the early days of Ada--consider an unchecked conversion as follows: type Foo is access Bar; function UC is new Unchecked_Conversion(Foo, Integer); Now try to port the code to an Ada implementation where Integer is 16 bits. You think you can just redefine UC, but it is not that easy. The worst horror of this type I ever ran into took over a week to rehide a public conversion between two "slightly different" record layouts. The most embarrassing part of that was that the initial author's intent was to speed up access by not using record variants, and the properly hidden code was significantly faster.