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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3d9f3074dc2c4699 X-Google-Attributes: gid103376,public From: bbalfour@std.caci.com (Brad Balfour) Subject: Re: How to overload assignment in Ada 95? Date: 1996/12/10 Message-ID: #1/1 X-Deja-AN: 203352235 distribution: usa references: <58aclh$ssd@gaia.cc.gatech.edu> organization: CACI, Inc. reply-to: bbalfour@std.caci.com newsgroups: comp.lang.ada Date: 1996-12-10T00:00:00+00:00 List-Id: In article , mheaney@ni.net (Matthew Heaney) wrote: [snip] >Does anyone have a rule of thumb for when a controlled type should publicly >derive from type Ada.Finalization.Controlled? [snip] >In the former case, clients of the Unbounded_Stack have direct visibility >to the operations Initialize, Finalize, and Adjust. When is this a good >thing? A bad thing? This exact question was dealt with in the next two articles in the Tips & Tidbits series (see ): Number 2: Expressing Design Inheritance Relationships in Ada 95, published in Ada Letters, Vol. XV No. 3, May/June, 1995. Number 3: Inheritance and Child Library Units, published in Ada Letters, Vol. XV No. 4, July/August, 1995. There are actually two separate issues/trade-offs: 1) A visible extension vs a private extension of the parent and 2) Derivation in the visible part vs. a private type and derivation in the private part. The above two articles discuss when each technique is appropriate. However, one conclusion has become fairly obvious in retrospect. If overridings of Adjust, Finalize and Initialize are provided in the visible part, then it is possible for clients to call them directly -- a situation that is *not* desireable. Therefore, I now recommended that the overriding declarations appear in the private part. However, moving the overridings to the private part opens the (small) possiblity that the type declaration becomes frozen prior to these declarations. If this were to happen, the compiler would issue an error message. At that point, the developer can then modify the code to move the declarations prior to the freezing point. >-------------------------------------------------------------------- >Matthew Heaney >Software Development Consultant >mheaney@ni.net >(818) 985-1271 -- Brad Balfour SIGAda WWW Server CACI, Inc. http://www.acm.org/sigada/ (703) 277-6767 and also try: bbalfour@std.caci.com http://www.adahome.com/ address: 3930 Pender Drive * Fairfax, VA 22030 "...they even have have rules on exceptions" -- Dewar and Schonberg