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-Thread: 103376,910a48a538936849 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s72.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: how to import a package References: <1165371252.358817.57840@80g2000cwy.googlegroups.com> <1165449396.112251.129200@l12g2000cwl.googlegroups.com> In-Reply-To: <1165449396.112251.129200@l12g2000cwl.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s72 1165464377 12.201.97.213 (Thu, 07 Dec 2006 04:06:17 GMT) NNTP-Posting-Date: Thu, 07 Dec 2006 04:06:17 GMT Date: Thu, 07 Dec 2006 04:06:17 GMT Xref: g2news2.google.com comp.lang.ada:7840 Date: 2006-12-07T04:06:17+00:00 List-Id: markww wrote: > Yes I'm still confused - sorry - I'm coming from C++ / java and the ada > syntax / scoping is a bit strange to me. So I thought a package is > equivalent to a structure/class. A package provides modularity, encapsulation, information hiding, and namespace control. A C++ struct is the equivalent of an Ada record type. A C++ class provides encapsulation and information hiding. C++ namespaces provide namespace control. Nothing in C++ provides modularity, although header files and preprocessor textual inclusion provide an imitation. > I thought that the following line: > > package Person_List in new P (T => PERSON_REC) > > is just instantiating one instance of the package called Person_List. Right. P is a generic package, and this creates an instantiation of it, a package named Person_List. > So the line: > > Start : Person_List.Node_Ptr; > > doesn't make sense to me since it looks like 'Start' is being defined > as pointing to Person_List.Node_Ptr, when I thought the right side of > the colon must be a data type. Start is a variable object, of type Person_List.Node_Ptr. The type's simple name is Node_Ptr, but that's not visible. The expanded name (Person_List.Node_Ptr) means it's Node_Ptr in Person_List. > In any event, I can't event get past adding the following line under > the package: > > package Person_List is new P (T => PERSON_REC); > > my compiler (gnat) gives an error saying: > > operator for type "Node_Ptr" defined at line 23, nstance at line 39 > is not directly visible > use clause would make operation legal That's an odd msg; without more context I don't know what it's trying to tell you. This line has to come after the declaration of Person_Rec. -- Jeff Carter "People called Romanes, they go the house?" Monty Python's Life of Brian 79