From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: how to import a package
Date: Thu, 07 Dec 2006 04:06:17 GMT
Date: 2006-12-07T04:06:17+00:00 [thread overview]
Message-ID: <ZqMdh.306552$1i1.255203@attbi_s72> (raw)
In-Reply-To: <1165449396.112251.129200@l12g2000cwl.googlegroups.com>
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
prev parent reply other threads:[~2006-12-07 4:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 2:14 how to import a package markww
2006-12-06 3:06 ` Adam Beneschan
2006-12-06 3:34 ` markww
2006-12-06 9:18 ` Simon Wright
2006-12-06 19:47 ` Jeffrey R. Carter
2006-12-06 23:56 ` markww
2006-12-07 1:18 ` Björn Persson
2006-12-07 1:26 ` Brian May
2006-12-07 4:14 ` markww
2006-12-07 4:40 ` Brian May
2006-12-07 9:32 ` Stuart
2006-12-07 11:21 ` Jean-Pierre Rosen
2006-12-11 6:16 ` markww
2006-12-11 6:50 ` markww
2006-12-11 9:40 ` Georg Bauhaus
2006-12-11 14:19 ` markww
2006-12-11 15:03 ` Dmitry A. Kazakov
2006-12-11 16:22 ` Adam Beneschan
2006-12-11 20:28 ` Jeffrey R. Carter
2006-12-12 3:19 ` markww
2006-12-12 3:31 ` Jeffrey R. Carter
2006-12-12 9:03 ` Stuart
2006-12-12 10:56 ` Georg Bauhaus
2006-12-11 7:00 ` Simon Wright
2006-12-07 4:06 ` Jeffrey R. Carter [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox