comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Trouble with renaming types
Date: 09 May 2001 09:18:13 -0400
Date: 2001-05-09T13:33:46+00:00	[thread overview]
Message-ID: <ud79izmne.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 9d93ri$lhv$2@newsg3.svr.pol.co.uk

"Bob McChesney" <bob@teambob.freeserve.co.uk> 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



  parent reply	other threads:[~2001-05-09 13:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-08 15:37 Trouble with renaming types Bob McChesney
2001-05-08 15:45 ` Bob McChesney
2001-05-08 16:45   ` Mark
2001-05-08 17:12     ` Bob McChesney
2001-05-09 13:18 ` Stephen Leake [this message]
2001-05-09 15:22   ` Bob McChesney
  -- strict thread matches above, loose matches on Subject: below --
2001-05-09  4:59 Christoph Grein
2001-05-09 15:15 ` Bob McChesney
replies disabled

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