comp.lang.ada
 help / color / mirror / Atom feed
* Anything Else Like Child Units?
@ 1997-08-04  0:00 david scott gibson
  0 siblings, 0 replies; 2+ messages in thread
From: david scott gibson @ 1997-08-04  0:00 UTC (permalink / raw)



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
--
dgibson@cis.ohio-state.edu
 




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Anything Else Like Child Units?
       [not found] <5s647h$1fr$1@goanna.cs.rmit.edu.au>
@ 1997-08-11  0:00 ` Tucker Taft
  0 siblings, 0 replies; 2+ messages in thread
From: Tucker Taft @ 1997-08-11  0:00 UTC (permalink / raw)



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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-08-11  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-04  0:00 Anything Else Like Child Units? david scott gibson
     [not found] <5s647h$1fr$1@goanna.cs.rmit.edu.au>
1997-08-11  0:00 ` Tucker Taft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox