From: "Björn Persson" <spam-away@nowhere.nil>
Subject: Re: how to import a package
Date: Thu, 07 Dec 2006 01:18:50 GMT
Date: 2006-12-07T01:18:50+00:00 [thread overview]
Message-ID: <_ZJdh.25636$E02.10609@newsb.telia.net> (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.
No, a struct in C would be a record in Ada. A class in C++ corresponds to a
tagged record type in Ada. C++ doesn't have anything quite like a package;
I'd say the closest you get is a namespace. In Java, the classes serve as
both data types and packages. Not so in Ada. An Ada package isn't a data
type any more than a C++ namespace is.
What you have is a generic package. Generics in Ada fill the same role as
templates in C++, but they're not quite the same thing. When you
instantiate a C++ template you get a class ? a data type. When you
instantiate a generic package in Ada you get a package, which can in turn
contain data types, subprograms and other things. (Ada also has generic
subprograms, but no generic data types.)
> 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.
Right. Node_Ptr is a data type, and its declaration is to be found in the
package Person_List. Start is an object (a variable) of this type.
--
Bj�rn Persson PGP key A88682FD
omb jor ers @sv ge.
r o.b n.p son eri nu
next prev parent reply other threads:[~2006-12-07 1:18 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 [this message]
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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox