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.1 required=5.0 tests=BAYES_05,INVALID_MSGID,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107e1d,c8f58d04ea55331,start X-Google-Attributes: gid107e1d,public X-Google-Thread: 103376,c8f58d04ea55331,start X-Google-Attributes: gid103376,public From: "Ashley Manos" Subject: Generic Packages in Ada Date: 2000/08/10 Message-ID: <39926569@newsserver1.picknowl.com.au>#1/1 X-Deja-AN: 656670235 X-Original-NNTP-Posting-Host: popadl-12-058.picknowl.com.au X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Complaints-To: abuse@telstra.net X-Trace: nsw.nnrp.telstra.net 965895509 203.24.77.2 (Thu, 10 Aug 2000 18:18:29 EST) Organization: Customer of Telstra Big Pond Direct X-Original-Trace: 10 Aug 2000 17:48:49 +0950, popadl-12-058.picknowl.com.au X-MSMail-Priority: Normal NNTP-Posting-Date: Thu, 10 Aug 2000 18:18:29 EST Newsgroups: comp.lang.ada,fr.comp.lang.ada Date: 2000-08-10T00:00:00+00:00 List-Id: Hi - can anyone help me with this: I'm attempting to write a generic package for linked lists in Ada. The data structure I'm looking to make generic is the element ie each element in the list is composed of 2 parts: the elemtn and a pointer to the next element. So my package spec looks something like this: generic type Node is private; -- here's the list element type List is access Node; -- here's the pointer to the next element in the list package Lists is function CreateList(N:in Node) return List; procedure AddToRear(N:in Node; L:in out List); procedure RemoveFirst(N:in Node; L:in out List); end Lists; However, the compiler is complaining (and rightly so!) about my package body, the start of which looks like this: package body Lists is function CreateList(N:in Node) return List is L:List; begin L:= new Node; L.Next:= Null; *** return L; end CreateList; ............... etc .................. The compiler is saying "invalid prefix in selected component L" about the line ***. I can see why the compiler is raising this error, but I need my function to refer to the "Next" component of the element, as it will be of type "List" ie the pointer to the next element. If this makes absolutely any sense to anybody that might be able to help, could you PLEASE reply. Thanks Ashley (atm@picknowl.com.au)