From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: premature use
Date: Sun, 05 May 2002 18:20:11 GMT
Date: 2002-05-05T18:20:11+00:00 [thread overview]
Message-ID: <3CD577E0.8040409@worldnet.att.net> (raw)
In-Reply-To: slrnadaiek.5uk.randhol+abuse@kiuk0152.chembio.ntnu.no
Try putting File_List and Index_List in a child package
package Help_Lists.File_Lists is
package File_List is
new Double_Linked_List(Data_Type => Help_File_Type);
pacakge Index_List is new
Double_Linked_List(Data_Type => Help_Index_Type);
end Help_Lists.File_Lists;
Jim Rogers
Preben Randhol wrote:
> 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?
>
> Thanks in advance.
>
> Preben
> --------------------------------------------------------------------
> with Double_Linked_List;
> with Ada.Strings.UnBounded; use Ada.Strings.UnBounded;
>
> pragma Elaborate_All (Double_Linked_List);
>
> package Help_Lists is
>
> type Help_File_Type is private;
> type Help_Index_Type is private;
>
> package File_List is
> new Double_Linked_List (Data_Type => Help_File_Type);
>
> package Index_List is
> new Double_Linked_List (Data_Type => Help_Index_Type);
>
> private
> type Help_File_Type is
> record
> Topic : Unbounded_String;
> Text : Unbounded_String;
> end record;
>
> type Help_Index_Type is
> record
> Section : Unbounded_String;
> List : File_List.List_Type;
> end record;
>
> Help_List : Index_List.List_Type := Index_List.New_List;
>
> end Help_Lists;
> ---------------------------------------------------------------------
>
next prev parent reply other threads:[~2002-05-05 18:20 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 [this message]
2002-05-06 9:20 ` Preben Randhol
2002-05-06 14:06 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox