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-23T01:54:58+00:00	[thread overview]
Message-ID: <dale-2306991154580001@dale.cs.rmit.edu.au> (raw)
In-Reply-To: m3so7k3bsp.fsf@mheaney.ni.net

Matthew Heaney wrote:

" Yes, but you can make use of them in the private region.  For example,
  this would be a handy way to implement the full view (declared in the
  private region) of a private type (whose partial view is declared in the
  public region).
 
  As was suggested in earlier posts:
  
  1) Declare the private stuff in the private region of the root package.
     This way you can get rid of the intermediate package:
  
   [example deleted]"


I don't particuarly like this scheme, because it relies on all the children
having access to the private details of the type.
 
 
"2) Declare the private stuff in a child, declare grandchildren that use
    that private stuff, and then rename the grandchildren as children:
 
 [example deleted]
 
 
 The idea behind both of these schemes is to hide that fact that private
 stuff is being used at all.  You don't what to expose publicly (in the
 form of an intermediate package in the hierarchy) what is essentially an
 implementation issue."


Still not quite what i want to do. I would like to be able to build
subsystems where I have internal private packages whose type and
operations are visible within the private hierachy, but can also be
used to build (in the private parts of public packages) abstractions
that can be seen by everyone. (Having reread my original post i realise
now that i didn't mention private packages, which may have caused 
some confusion).

E.g.

   ----------------------------------------------------
   package P is
   end P;

   ----------------------------------------------------
   private package P.Private_Stuff is
      type PPS is private;
      blah blah blah;

   private
      <stuff>
   end;

   ----------------------------------------------------
   with P.Private_Stuff; use P.Private_Stuff;

   package P.Public_Stuff is
      type PPublic is private;
      blah blah blah;

   private
      type PPublic is -- a record with PPS components, 
                      -- or "new PPS;"
   end;
   ----------------------------------------------------

Of course there would have to be a restriction that the public section
of P.Public_Stuff could not export any of the information from the 
private package (e.g. no renames, subtypes etc).

Your 2nd proposal has the problem that implementation of types declared
in P.Private_Stuff can be seen by any child packages, so you loose any
ability to do hiding of abstractions -within- a hierachy.


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 ` Dale Stanbrough
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       ` Tucker Taft
1999-06-22  0:00         ` Richard D Riehle
1999-06-22  0:00           ` Dale Stanbrough
1999-06-22  0:00             ` Matthew Heaney
1999-06-23  0:00               ` Dale Stanbrough [this message]
1999-06-23  0:00                 ` Matthew Heaney
1999-06-23  0:00                   ` Dale Stanbrough
1999-06-23  0:00                     ` Richard D Riehle
1999-06-23  0:00                       ` John Duncan
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-24  0:00                       ` Dale Stanbrough
1999-06-22  0:00             ` Richard D Riehle
1999-06-21  0:00     ` Matthew Heaney
1999-06-25  0:00   ` Robert Dewar
replies disabled

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