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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a218418d0394661d X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Extended revelation Date: 2000/01/31 Message-ID: <3Cfl4.1352$gC3.64742@newsread1.prod.itd.earthlink.net>#1/1 X-Deja-AN: 579867412 Content-transfer-encoding: 7bit References: <873q03$alb$1@nnrp1.deja.com> Content-Type: text/plain; charset="US-ASCII" X-ELN-Date: Mon Jan 31 04:54:23 2000 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 949323263 38.26.88.104 (Mon, 31 Jan 2000 04:54:23 PST) Organization: EarthLink Network, Inc. Mime-version: 1.0 NNTP-Posting-Date: Mon, 31 Jan 2000 04:54:23 PST Newsgroups: comp.lang.ada Date: 2000-01-31T00:00:00+00:00 List-Id: In article <873q03$alb$1@nnrp1.deja.com> , Jean-Marc Bourguet wrote: > My problem is that in one of the child package, I'd like to make > public one of the private type (T). I had though that > > type T1 is private; > private > subtype T1 is T; > > but that's not valid. No, you can't implement the full view of a private type as a subtype. > As renanimg does not apply to types I can't see > an easy way to do it. Currently I'm using > > type T1 is private; > private > type T1 is new T; Yes, this is one way to do it. One issue with this solution is that there's no clean separation between public and private namespaces. That is, certain (usually predefined) operations can become directly visible at the point of declaration of the full view (here, T), and they may conflict with operations declared for the partial view. The best thing to do is always implement the full view of a private type as a record: package P is type T1 is private; private type T1 is record O : T; end record; end P; Now there is no problem. Indeed, I consider it a design flaw in the language, in that it allows you to implement the full view as something other than a record. I wish they had designed Ada83 private types the same way they designed Ada95 tagged types. > I've also considered exporting T from the parent package, but neither > solution please me. I'm not sure what you mean by this. Matt