comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <marc.a.criley@lmco.com>
Subject: Generic instantiation in client vs child package
Date: 1998/10/13
Date: 1998-10-13T00:00:00+00:00	[thread overview]
Message-ID: <36234017.2AB1975B@lmco.com> (raw)

The following behavior is seen with GNAT 3.11b-beta on
Linux 2.0.33 (COL 1.2).

When instantiating a particular generic from Corey Minyard's "Ada
Structured Library" (http://www.concentric.net/~Minyard) I get a
clean compile in one situation and an error in another, and I'm
not sure why.  I expect it's something I'm overlooking in Ada 95.

Given a simple package spec:

-- plain.ads
package Plain is

   type P is private;

private
   type P is new Integer;

end Plain;

The following instantiation of a dynamic list in a client package
compiles cleanly:

-- plain_list.ads
with ASGC.List.Dynamic;  -- from ASL 1.0
with Plain;

package Plain_List is

   package P_Container is new ASGC(Contained_Type => Plain.P,
                                   "="            => Plain."=");
   package P_List is new P_Container.List;
   package P_List_Dyn is new P_List.Dynamic;

end Plain_List;

However, if I instantiate within a child, rather than client,
package:

-- plain-list.ads
with ASGC.List.Dynamic;

package Plain.List is

   package P_Container is new ASGC(Contained_Type => P,
                                   "="            => "=");
   package P_List is new P_Container.List;
   package P_List_Dyn is new P_List.Dynamic;

end Plain.List;

I get this error:

plain-list.ads:9:04: instantiation error at asgc-list-dynamic.ads:26
plain-list.ads:9:04: "Object" not declared in "List"
plain-list.ads:9:04: instantiation error at asgc-list-dynamic.ads:27
plain-list.ads:9:04: tagged type required, found type "Object" defined at
asgc-list-dynamic.ads:26, instance at line 9
<Two more similar error blocks are also produced>


Why is this instantiation acceptable in a client package, but not
in a child package?

-- 
Marc A. Criley
Chief Software Architect
Lockheed Martin ATWCS
marc.a.criley@lmco.com
Phone: (610) 354-7861
Fax  : (610) 354-7308




             reply	other threads:[~1998-10-13  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-13  0:00 Marc A. Criley [this message]
1998-10-13  0:00 ` Generic instantiation in client vs child package Tucker Taft
replies disabled

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