comp.lang.ada
 help / color / mirror / Atom feed
From: dale@cs.rmit.edu.au (Dale Stanbrough)
Subject: Re: Private Children
Date: 1999/06/23
Date: 1999-06-23T03:59:55+00:00	[thread overview]
Message-ID: <dale-2306991359560001@dale.cs.rmit.edu.au> (raw)
In-Reply-To: m3g13jeglj.fsf@mheaney.ni.net

Matthew Heaney wrote:

" Every child (C1, C2) has access to the private part of its parent (P).
  There's no such thing as "hiding within a hierarchy.""

There is. Consider the following...


   pacakge P is
   end P;

   package P.A is
      type X is private;
   ...
   end A;


   with P.A;
   package P.B is
      type Y is private;
      -- operations on Y

   private
      type Y is record
            Item : X;
         end record;
   end P.B;


Clearly package P.B has no access to the private implementations
of package P.A (and they -are- in the same hierachy, it's just that
one is not a lineal (package) descendent of the other).

Consider the following...

The example above compiles fine. External users of type Y are happy.
Package P.B is prevented from knowing the internal implementation of
type X.

But let's also assume that we didn't want to give access to type X to
the rest of the world. What I would -like- to do is to make P.A private,
so that it can't be seen, but still retain type X's private status.

It would be nice if i could simply make P.A. a private package.
Unfortunately Ada confuses "compilation privacy" with "implementation
privacy". I am forced (simply because I want to hide some internal 
details) to sacrifice my privacy designs to the gods of compilation
efficiency (which is the opposite of what "private" means in the
rest of Ada).


" Child packages were designed not to hide visibility from within the
  hierarchy.  They were designed to /deliberately/ expose the private part
  to children, and to allow you to easily identify which packages have
  that private knowledge."


Yes I know that, but I'm not concerned about parent/child packages, but
about sibling (or rather non lineal descendant) packages/privacy issues.

I think that the current situation forces too much exposure of
implementation issues that will cause package hierachies to end up 
a large entagled mess, because we are continually forced to abandon
internal privacy goals to meet external ones.

Dale




  reply	other threads:[~1999-06-23  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-20  0:00 Private Children Matthew Heaney
1999-06-21  0:00 ` Ted Dennison
1999-06-21  0:00   ` Tucker Taft
1999-06-21  0:00     ` Matthew Heaney
1999-06-21  0:00     ` Matthew Heaney
1999-06-21  0:00       ` Tucker Taft
1999-06-22  0:00         ` Richard D Riehle
1999-06-22  0:00           ` Dale Stanbrough
1999-06-22  0:00             ` Richard D Riehle
1999-06-22  0:00             ` Matthew Heaney
1999-06-23  0:00               ` Dale Stanbrough
1999-06-23  0:00                 ` Matthew Heaney
1999-06-23  0:00                   ` Dale Stanbrough [this message]
1999-06-23  0:00                     ` Richard D Riehle
1999-06-23  0:00                       ` Vladimir Olensky
1999-06-23  0:00                         ` Richard D Riehle
1999-06-24  0:00                           ` Hyman Rosen
1999-06-24  0:00                             ` Richard D Riehle
1999-06-23  0:00                       ` John Duncan
1999-06-24  0:00                       ` Dale Stanbrough
1999-06-25  0:00   ` Robert Dewar
1999-06-21  0:00 ` Dale Stanbrough
replies disabled

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