From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,95e83dd0c6370d84 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-09 09:54:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: premature use Date: 06 May 2002 10:06:56 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1020694418 27213 128.183.220.71 (6 May 2002 14:13:38 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 6 May 2002 14:13:38 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:23780 Date: 2002-05-06T14:13:38+00:00 List-Id: Preben Randhol 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