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,FREEMAIL_FROM autolearn=ham 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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: how to import a package Date: Mon, 11 Dec 2006 07:00:48 +0000 Organization: Pushface Message-ID: References: <1165371252.358817.57840@80g2000cwy.googlegroups.com> <4577dc92$1_1@glkas0286.greenlnk.net> <7ft8le.vk1.ln@hunter.axlog.fr> <1165817760.736164.218530@73g2000cwn.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1165820448 5599 62.49.19.209 (11 Dec 2006 07:00:48 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 11 Dec 2006 07:00:48 +0000 (UTC) Cancel-Lock: sha1:9q6G9+7AzjGXWIWvFaWM4C7w+GY= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news2.google.com comp.lang.ada:7880 Date: 2006-12-11T07:00:48+00:00 List-Id: "markww" writes: > Ok I still don't understand why this assignment is illegal though - > here's a test I have: > > generic > type T is private; > package GenericNode is > type Node; > type Node_Ptr is access Node; > type Node is record > Data : T; -- the generic data we want to > store in a node. > Prev_Rec : access Node_Ptr; -- points to the next record or > null if none exists. > Next_Rec : access Node_Ptr; -- points to the previous > record or null if none exists. > end record; > end GenericNode; > > now later... > > package gNode is new GenericNode(T => PERSON_REC); > use gNode; > > function Test(whatever : INTEGER) return INTEGER is > Temp : gNode.Node_Ptr; > begin > Temp := Temp.Next_Rec; -- no!!!!!!!!!!!!!!!! > return 0; > end Test; > > Why is the Temp assignment not possible? The compiler says: expected > type Node_Ptr defined in genericnode.ads. But I have defined it as type > Node_Ptr. You've declared Next_Rec as *access* Note_Ptr. I think you meant to declare it as just Node_Ptr. struct node { T data; node** prev_rec; /* should be just node* ? */ node** next_rec; }; Also, look at the way you've commented on Prev_Rec and Next_Rec. Aside from the comments being the wrong way round, you say 'points to the ... record'. As written, it points to *a pointer to* the .. record.