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,becfcd482f73209e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-09 06:25:52 PST Path: newsfeed.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Trouble with renaming types Date: 09 May 2001 09:18:13 -0400 Organization: NASA Goddard Space Flight Center Message-ID: References: <9d93ri$lhv$2@newsg3.svr.pol.co.uk> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 989415226 15483 128.183.220.71 (9 May 2001 13:33:46 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 9 May 2001 13:33:46 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6 Xref: newsfeed.google.com comp.lang.ada:7362 Date: 2001-05-09T13:33:46+00:00 List-Id: "Bob McChesney" writes: > Can anyone help me with this problem I have please? > > I'm instantiating a generic package Set_Class from within another package. I > instantiate the package as WordSet, and this means a resulting type that I > need to use is WordSet.Set. However, I want to be able to reference this > type under another name from outside the package (I want to call it > Dictionary). > > I think I'm supposed to just use a subtype order (subtype Dictionary is > WordSet.Set), however I'm keeping the instantiation of the package private, > which means I can't do this unless I put the subtype order after the > instantiation (which would place it inside the private area and it doesn't > like that). > > So can anyone tell me a way of renaming a private type, inside a package? > That would be really good. The only way to get a public type that is a "renaming" of a private type is to introduce a layer: with Set_Class; package Foo type Dictionary is private; private package WordSet is new Set_Class (...); type Dictionary is record Words : WordSet.Set; end record; end Foo; > So far the only way it's worked is to take everything out of private > but this is not how I need it. It would help if you could expand on why it is not appropriate to make WordSet public. If you are building an additional abstraction layer, then you will probably find other items to put in the Dictionary record type, which will make it seem less painful. -- -- Stephe