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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,172cdcb8e77bfc0b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-12 18:37:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-pas-nf2!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3EE92ACC.8010302@spam.com> From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: semi-visibility References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 13 Jun 2003 01:37:21 GMT NNTP-Posting-Host: 63.184.16.33 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1055468241 63.184.16.33 (Thu, 12 Jun 2003 18:37:21 PDT) NNTP-Posting-Date: Thu, 12 Jun 2003 18:37:21 PDT Xref: archiver1.google.com comp.lang.ada:39074 Date: 2003-06-13T01:37:21+00:00 List-Id: tmoran@acm.org wrote: > I want to do the following, but it's illegal. What's a good way to > accomplish the purpose, preferably without increasing the depth of > the package heirarchy, or enlarging package A. > > private package A.B is > type Visible_To_Relatives is ... > end A.B; > > with A.B; > package A.C is > type T is private; > procedure P(x : in T); > private > type T is record > v : A.B.Visible_To_Relatives; > end record; > end A.C; One solution is to wait for Ada 0X. It has a way to to do this; IIRC, it's "with private". If you need it sooner, one solution is private type T_Implementation; type T is access [all] T_Implementation; end A.C; This gets you into possible problems with initialization and finalization that you might be able to alleviate by using Ada.Finalization. A simpler solution is to make A.B non-private and attempt to enforce a rule that it only be referenced in the private parts and bodies of children of A. -- Jeff Carter "C's solution to this [variable-sized arrays] has real problems, and people who are complaining about safety definitely have a point." Dennis Ritchie