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,dcfb683e015fdcef,start X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Anything Else Like Child Units? Date: 1997/08/11 Message-ID: #1/1 X-Deja-AN: 263526507 Sender: news@inmet.camb.inmet.com (USENET news) References: <5s647h$1fr$1@goanna.cs.rmit.edu.au> X-Nntp-Posting-Host: houdini.camb.inmet.com Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1997-08-11T00:00:00+00:00 List-Id: Dale Stanbrough (dale@goanna.cs.rmit.edu.au) wrote: : david scott gibson writes: : "Hi. Does anyone know of another programming mechanism similar to : Ada's child units that supports unplanned component extension and : is not based on inheritance? I would not include C++'s friend : functions since these do not seem to provide much support for : unplanned extension. Is the hierarchical library structure : unique to Ada, or was it based on some ideas from other languages? : : Dave" : Child packages are not about component extension (you can extend : a type in any package, if you can see that it is a tagged type). If you think of a "component" as a package, then you could view a child package as an extension of a component. I prefer to use the term "abstraction" and see child packages as a way to structure and extend an abstraction, both pre-planned and after the fact. The child package concept of Ada 95 was to some extent inspired by the library mechanism of VHDL. However, the VHDL "library" mechanism only supports a two-level hierarchy (library name, plus unit within library). [It is not a total coincidence that Intermetrics was also the prime contractor on the design of VHDL. ;-)] Note that C++ also has hierarchical namespaces, and Java has hierarchical packages. In C++ (and VHDL for that matter), the namespaces have no connection with visibility -- there are no declarations that are somehow "private" to a namespace. In Java, packages are related to visibility control, but surprisingly (at least in comparison to Ada), the hierarchy is not relevant. If two classes are in the very same Java package then they have visibility on the entities with no specified visibility (e.g., non-public, non-private, non-protected). However, if on is in a sub-package of the other's, no special visibility is provided (which I find a bit of a pain in my use of Java packages). : Child packages can provide a protected view (c.f. protected in C++) : for inheritance. : They can also provide a way to structure code that has no inheritance : relationship (e.g. i have some packages such as unix, unix.file, : unix.process etc). : Dale -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA