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,4103f02f9e6c4df2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-12 16:12:26 PST Path: supernews.google.com!sn-xit-02!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Jeff Creem" Newsgroups: comp.lang.ada Subject: Re: Ada 0y wish list: "with private" Date: Mon, 12 Feb 2001 19:13:54 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <968p1e$8m7$1@s1.read.news.oleane.net> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Complaints-To: newsabuse@supernews.com Xref: supernews.google.com comp.lang.ada:5202 Date: 2001-02-12T19:13:54-05:00 List-Id: I am not entirely wild about this. It seems like a great way to break the private abstraction and shoot yourself. If C needs to need to know that much about B then it should be a child of B. Sure having something like this lets you be a little sloppier about the interfaces you provide to users of your package but without more of an example my gut tells me that you are missing the reason things are put in the private section. "Thierry Lelegard" wrote in message news:968p1e$8m7$1@s1.read.news.oleane.net... > Recently, several wishlist items for Ada 0y were posted in c.l.a. > Like many old Ada users, I have a couple of them. I would like to > propose one for discussion: a "with private" extension. > > The idea is to specify in a context clause of a unit spec that an > external unit can be used only in the private part. > > Example: > > with A; > with private B; > package C is > X : A.TA; > private > Y : B.TB; -- legal only in private part > end C; > > There are two advantages: > > 1) Readability. The user of package C is only interested in the public > interface of C. Reading "with private B", the user knows that he may > safely ignore what the strange unit B is all about. > > 2) Use of private packages in private parts. Example: > > package Lib is ... > > private package Lib.Internals is .... > > with private Lib.Internals; > package Lib.Public is > .... > private > type TP is new Lib.Internals.TI ... > end Lib.Public; > > The second point is, of course, more important than the first one. Some > of my recent code could have been much simpler with such a possibility. > In Ada 95, a private package cannot be referenced at all in the spec > of a public package, even in the private part, since the context clause > "with Lib.Internals" is simply refused. > > Two points: > - The "with private" syntax is, of course, only a suggestion. > - Maybe there is some implementation flaw that I missed. > > Any ideas or objections? > -Thierry > ____________________________________________________________________________ > > Thierry Lelegard, "The Jazzing Troll", Email: thierry.lelegard@canal-plus.fr > CANAL+ Technologies, 34 place Raoul Dautry, 75516 Paris Cedex 15, France > Tel: +33 1 71 71 54 30 Fax: +33 1 71 71 52 08 Mobile: +33 6 03 00 65 75 > ____________________________________________________________________________ > >