From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Re: Basic Explaination of OO in Ada
Date: Tue, 19 Sep 2006 18:14:00 +0200
Date: 2006-09-19T18:14:00+02:00 [thread overview]
Message-ID: <4naja2F9iufgU1@individual.net> (raw)
In-Reply-To: 1158681993.370326.304680@k70g2000cwa.googlegroups.com
Ludovic Brenta wrote:
> Alex R. Mosteo wrote:
>> Just a note: although what Ludovic writes is right, and you can only have
>> vanilla arrays of definite types, you can have more sophisticated
>> containers (for example Ada.Containers.Indefinite_Vectors) that store
>> class-wide types in Ada 2005:
>>
>> package Pak_Vectors is
>> new Ada.Containers.Indefinite_Vectors (Positive, Pak.T'Class);
>>
>> In this case, however, you store copies so some overhead can occur, but
>> in many cases it can be more convenient than starting to play with
>> pointers.
>
> Doesn't Ada.Containers.Indefinite_Vectors have to declare a class-wide
> access type for its internal use? I'd guess so. But, it hides the
> access type from the user, and that's encapsulation at its best.
Yep, I suppose so (but I didn't looked for it).
> In Ada, one rarely needs access types at all. The only justification
> for declaring one is because you're doing some kind of dynamic data
> structure and allocating dynamically on the heap. With the standard
> Ada.Containers, you'd need access types even less often.
Agreed.
> That's why in my examples I did not declare an access type along with
> the tagged type (in package P); instead, I declared an access type in
> another package (package Collection) because that package absolutely
> needed one.
Ok, I missed your intention with the example here, so I was trying to make
clear that one shouldn't be too keen on jumping to access types :)
next prev parent reply other threads:[~2006-09-19 16:14 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-18 15:24 Basic Explaination of OO in Ada richard.charts
2006-09-18 16:31 ` Georg Bauhaus
2006-09-18 16:43 ` Georg Bauhaus
[not found] ` <j%zPg.13190$bM.10526@newsread4.news.pas.earthlink.net>
2006-09-18 17:13 ` Javier Miranda
2006-09-18 17:51 ` Robert A Duff
2006-09-18 18:32 ` Gautier
2006-09-18 19:55 ` richard.charts
2006-09-19 3:29 ` Lucretia
2006-09-19 8:49 ` gautier_niouzes
2006-11-20 6:13 ` adaworks
2006-11-24 14:48 ` Marco
2006-11-24 15:15 ` Javier Miranda
2006-09-18 19:37 ` Lucretia
2006-09-18 20:25 ` Jeffrey R. Carter
2006-09-19 3:32 ` Lucretia
2006-09-19 13:56 ` richard.charts
2006-09-19 14:10 ` Lucretia
2006-09-19 14:23 ` richard.charts
2006-09-19 15:45 ` Dmitry A. Kazakov
2006-09-19 15:31 ` Ludovic Brenta
2006-09-19 15:56 ` Alex R. Mosteo
2006-09-19 16:06 ` Ludovic Brenta
2006-09-19 16:14 ` Alex R. Mosteo [this message]
2006-09-20 7:16 ` Maciej Sobczak
2006-09-19 20:45 ` Jeffrey R. Carter
2006-09-19 21:15 ` Hyman Rosen
2006-09-20 7:27 ` Dmitry A. Kazakov
2006-09-19 6:00 ` Martin Krischik
2006-09-19 20:33 ` Jeffrey R. Carter
2006-09-20 6:41 ` Martin Krischik
2006-09-21 1:37 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox