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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,910a48a538936849 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!j44g2000cwa.googlegroups.com!not-for-mail From: "markww" Newsgroups: comp.lang.ada Subject: Re: how to import a package Date: 5 Dec 2006 19:34:11 -0800 Organization: http://groups.google.com Message-ID: <1165376051.158320.95410@j44g2000cwa.googlegroups.com> References: <1165371252.358817.57840@80g2000cwy.googlegroups.com> <1165374364.874225.237370@n67g2000cwd.googlegroups.com> NNTP-Posting-Host: 66.65.64.109 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1165376056 25188 127.0.0.1 (6 Dec 2006 03:34:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 6 Dec 2006 03:34:16 +0000 (UTC) In-Reply-To: <1165374364.874225.237370@n67g2000cwd.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: j44g2000cwa.googlegroups.com; posting-host=66.65.64.109; posting-account=cNKOMg0AAADT2ug8oGSYYXo8bsDvrHzw Xref: g2news2.google.com comp.lang.ada:7818 Date: 2006-12-05T19:34:11-08:00 List-Id: Hi Adam, Thanks for your help. Now I've instantiated a list of my ppl records. Right underneath the generic package definition I had: Start : Node_Ptr; Last : Node_Ptr; but Node_Ptr is not visible. Is it no longer possible to have those two variables declared like that? Thanks, Mark Adam Beneschan wrote: > markww wrote: > > Hi, > > > > I have this snippet of code (from members here) which defines a generic > > type: > > > > generic > > type T is private; > > package P is > > type Node; > > type Node_Ptr is access Node; > > type Node is record > > Data : T; > > Prev_Rec : access Node; -- points to the next record or > > null if none exists. > > Next_Rec : access Node; -- points to the previous record or > > null if none exists. > > end record; > > end P; > > > > Now my compiler (gnat) complains that Node, and Node_Ptr are not seen > > by the rest of the application. Is this because they are scoped within > > package P? > > > > If so, how do I 'import' the package? Right now I just stuck this at > > the start of my main procedure: > > P is a generic package so you have to instantiate it. Something like: > > package Person_List is new P (T => Person_Rec); > > Now, Node and Node_Ptr are visible within Person_List, and the "Data" > field in Person_List.Node will have type Person_Rec. > > There's no such thing as a "generic type" in Ada. > > -- Adam