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,3ad42f911d53327e X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Object Oreinted Style Date: 2000/04/02 Message-ID: <8c68ma$cef$1@slb3.atl.mindspring.net>#1/1 X-Deja-AN: 605484007 References: <8bq4hh$psj$1@ssauraac-i-1.production.compuserve.com> <8c21qm$dbl$1@nnrp1.deja.com> Organization: MindSpring Enterprises X-Server-Date: 2 Apr 2000 01:44:42 GMT Newsgroups: comp.lang.ada Date: 2000-04-02T01:44:42+00:00 List-Id: In article , Dale Stanbrough wrote: >Private packages are useful, but only to an extent. They prevent >compilation coupling (changing a private packages spec will never >require the recompilation of a package outside of the hierachy), >but fail to provide the sort of support for abstractions that i'ld >like to see (the completion of a private type in a public package >being derived from a type declared in a private package). I find >them frustratingly limiting for this reason. >Of course this is in constrast to "private" types inside packages, >which do not prevent compilation coupling, but are used to support >abstractions! Actually, with clever use of access declarations, one can do exactly what you have just described under the model of an opaque type. I have been experimenting with just this kind of thing to see how far it can be stretched. In this case, the opaque type is an incomplete declaration in the private part of one package, The full type is a private type in a private child package and an access type points to the incomplete type. The full completed declaration, within the package body is a derivation from the type in the private package specification. It can even be another level of indirection via an access type. With this technique, one could modify the content of the body, extend the type in the body at will, and still have the benefits of a tagged type at the specification level for more extensions throughout the children rooted at the same level. Now we have a robust design using Meyer;s "open/closed principle." This is also a good technique when creating a classwide package, one that has only classwide operations in it that need to be implemented using data common to the entire parent-child hierarchy. Richard Riehle