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,6a11907952c890f5 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Visible or hidden derivation for controlled types ? Date: 1997/03/16 Message-ID: #1/1 X-Deja-AN: 226042219 References: <3329621A.3E9D@elca-matrix.ch> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-03-16T00:00:00+00:00 List-Id: In article <3329621A.3E9D@elca-matrix.ch>, Mats.Weber@elca-matrix.ch wrote: >There was a discussion some time ago in comp.lang.ada on whether Adjust, >Finalize and Initialize for Controlled types was better done in the >visible or private part of the package. In both cases, the type was >visibly derived from Ada.Finalization.Controlled. > >I'd like to know if it is better to make types visibly derived from >Ada.Finalization.Controlled, or do that derivation in the private part: I think the general advice according to the Rational is that the derivation be done privately. The guideline is that clients shouldn't care whether the type inherits from Controlled; that is an implementation detail. If clients really don't care, then it's an even better idea to hide the derivation, so the client can't accidently call Initialize or Adjust. Of course, you might be building a primitive abstraction, where the clients really do care that the abstraction is controlled. For example, a data structure library might contain an "unbounded collection," not for use by general clients, but used only to implement other higher-level-of-abstraction data structures. (And the controlled-ness is in turn hidden from the clients of those higher-level abstractions.) If your binary tree is for general consumption, then hide the derivation from Controlled. Matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271