comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Calling generic children from their parent?
Date: 1999/06/23
Date: 1999-06-23T00:00:00+00:00	[thread overview]
Message-ID: <m3909be89q.fsf@mheaney.ni.net> (raw)
In-Reply-To: 19990623004221.05877.00000987@ngol05.aol.com

On 23 Jun 1999 04:42, rcollinson@aol.com (RCollinson) wrote:

> I need to use a type in a generic parent body that is located in the
> generic child specification.

This is a strange way to organize a hierarchy of generic packages.
Perhaps we can find a better organization that avoids these problems
altogether.

> I am having problems instantiating the child in the parent's body.
> The type is not recognized unless it is instantiated.  Any ideas?

How is that different from any other generic?  To make an entity
provided by a generic available for use, you have to instantiate the
generic.

foo.bar is a generic, and so to use the types declared there, foo.bar
must first be instantiated.


> with foo.bar;
> package body foo is
>   My_Var : Foo.Bar.My_Extended_Type;  
>   -- !!! How do I get an instance of this variable
>   -- !!! that is a type from the generic child???
>   -- !!! Is this possible???
>
> end foo;

You have to instantiate generic package foo.bar.


> generic
> package foo.bar is
>    type My_Extended_Type is new My_Type with
>    record
> ...
>    end record;
> ...
> end foo.bar;


Why does this need to be in a (generic) child of foo?  Why can't it go
in the public or private region of foo?  (There's no technical reason it
can't, because foo.bar doesn't import any generic actual parameters.)

Move My_Extended_Type to foo, and get rid of foo.bar.  









      parent reply	other threads:[~1999-06-23  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-23  0:00 Calling generic children from their parent? RCollinson
1999-06-23  0:00 ` Dale Stanbrough
1999-06-23  0:00   ` rcollinson
1999-06-24  0:00     ` Tucker Taft
1999-06-24  0:00       ` rcollinson
1999-06-25  0:00         ` Tucker Taft
1999-07-01  0:00           ` rcollinson
1999-06-23  0:00 ` Matthew Heaney [this message]
replies disabled

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