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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ad988eb0a9545c86 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-13 03:42:13 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!newsfeed.icl.net!newspeer.clara.net!news.clara.net!nntp.news.xara.net!xara.net!gxn.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <9b46dr$cd8$1@taliesin.netcom.net.uk> <9b6jtu$4is$2@taliesin.netcom.net.uk> Subject: Re: Problem trying to implement generics. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Fri, 13 Apr 2001 11:35:49 +0100 NNTP-Posting-Host: 62.253.12.182 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 987158127 62.253.12.182 (Fri, 13 Apr 2001 11:35:27 BST) NNTP-Posting-Date: Fri, 13 Apr 2001 11:35:27 BST Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:6855 Date: 2001-04-13T11:35:49+01:00 List-Id: Hi, > The error from Object Ada is: > bintree.adb: Error: line 9 col 28 LRM:4.1(3), Direct name, root, is not > visible, Ignoring future references > > The error from GNAT is: > > bintree.adb:9:42: "root" is undefined (more references follow) > > With nothing more to follow this. Ok, this means it's not found a definition for it. It doesn't know what or where it is. You probably know that. [SNIP] > private > type Binary_Tree is new Ada.Finalization.controlled with record > root: Node_access := null; > end record; the error comes because > package body binTree is [snip] > procedure insert(insert_this : in data_type; Sort : in sort_by) is > New_node : Node_Access := new node; > current : Node_access := root; -- This is the line it compline about!! you've forgot to that Root is in Binary_Tree. I have a question. From your code it doesn't look like an ADT. Is this what you intended? I can't remember the term for what this looks like, but I think it's to do with storing the Tree as a global variable in the package not as an ADT. If you want an ADT you need to pass in a Binary_Tree type as necessary. I didn't see it any where in your code so i'm assuming it's based on a global variable. There's nothing wrong doing it this way! Regards, Chris Campbell