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.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!cme-durer!leake From: leake@cme-durer.ARPA (Stephe Leake) Newsgroups: comp.lang.ada Subject: Re: Ada language revision Message-ID: <749@marvin.cme-durer.ARPA> Date: 29 Nov 88 15:35:35 GMT References: <733@marvin.cme-durer.ARPA> <3656@hubcap.UUCP> Organization: National Bureau of Standards, Gaithersburg, MD In-reply-to: billwolf@hubcap.clemson.edu's message of 23 Nov 88 22:22:13 GMT List-Id: In article <3656@hubcap.UUCP> billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,) writes: Consider an ADT which contains pointers to substructures. A user declares an access type pointing to an instance of your ADT, and uses UNCHECKED_DEALLOCATION to destroy that instance after finishing with it. UNCHECKED_DEALLOCATION will not recursively chase down and free up what might constitute over 99% of the space occupied by the ADT. Similarly, if your ADT uses another ADT in its implememtation, your DESTROY procedure will include a call to the DESTROY procedure of the sub-ADT, but UNCHECKED_DEALLOCATION will remain oblivious to the method which must be used to properly destroy the sub-ADT. I see. Currently, the ADT author must provide a Destroy procedure, and hope that users of the ADT call it as needed. So it would be nice if the compiler would enforce this. This doesn't sound to bad; we just need to add a generic parameter to UNCHECKED_DEALLOCATION (LRM 13.10.1): generic type OBJECT is limited private; type NAME is access OBJECT; with procedure DESTROY (Y : in OBJECT) is <>; procedure UNCHECKED_DEALLOCATION (X : in out NAME); With a default definition of DESTROY declared in Standard, defining UNCHECKED_DEALLOCATION this way would not break any current Ada program that uses it. There is still a slight problem; if the appropriate DESTROY procedure is not visible at the time of instantiation, we lose. Stephe Leake (301) 975-3431 leake@cme.nbs.gov National Institute of Standards and Technology (formerly National Bureau of Standards) Rm. B-124, Bldg. 220 Gaithersburg, MD 20899