From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: premature use
Date: 06 May 2002 10:06:56 -0400
Date: 2002-05-06T14:13:38+00:00 [thread overview]
Message-ID: <uvga18j5r.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: slrnadaiek.5uk.randhol+abuse@kiuk0152.chembio.ntnu.no
Preben Randhol <randhol+abuse@pvv.org> writes:
> When I try to make the package as below I get from GNAT the error:
>
> premature use of private type
>
> I understand this is correct, but is it possible to make this package in
> a way that makes the Help_File_Type and Help_Index_Type private while
> keeping File_List and Index_List public?
Put the Help_index_Type in a grand-child package. This compiles with
GNAT 3.15a on Windows NT:
generic
type Data_Type is limited private;
package Double_Linked_List is
type List_Type is new Integer;
end Double_Linked_List;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Help_Files is
type Help_File_Type is private;
private
type Help_File_Type is
record
Topic : Unbounded_String;
Text : Unbounded_String;
end record;
end Help_Files;
with Double_Linked_List;
Package Help_Files.Lists is
package File_List is
new Double_Linked_List (Data_Type => Help_File_Type);
end Help_Files.Lists;
package Help_Files.Lists.Indexes is
type Help_Index_Type is private;
private
type Help_Index_Type is
record
Section : Unbounded_String;
List : File_List.List_Type;
end record;
end Help_Files.Lists.Indexes;
package Help_Files.Lists.Indexes.Lists is
package Index_List is
new Double_Linked_List (Data_Type => Help_Index_Type);
private
-- Help_List : Index_List.List_Type := Index_List.New_List;
Help_List : Index_List.List_Type := 1;
end Help_Files.Lists.Indexes.Lists;
--
-- Stephe
prev parent reply other threads:[~2002-05-06 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-05 15:03 premature use Preben Randhol
2002-05-05 18:20 ` Jim Rogers
2002-05-06 9:20 ` Preben Randhol
2002-05-06 14:06 ` Stephen Leake [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