comp.lang.ada
 help / color / mirror / Atom feed
From: Sven <sven.weidauer@gmail.com>
Subject: Re: How to pass around access types to interfaces?
Date: Wed, 29 Oct 2008 05:42:38 -0700 (PDT)
Date: 2008-10-29T05:42:38-07:00	[thread overview]
Message-ID: <547a5372-f337-4cc4-a05e-953f8a5a70e0@v28g2000hsv.googlegroups.com> (raw)
In-Reply-To: op.ujk7aodyz25lew@macpro.krischik.com

On 25 Okt., 16:43, "Martin Krischik" <krisc...@users.sourceforge.net>
wrote:
> Am 24.10.2008, 13:45 Uhr, schrieb Sven <sven.weida...@gmail.com>:
>
> >   type My_Interface_Access is access all My_Interface'Class;
>
> Do you realy need an access type? Read:
>
> http://en.wikibooks.org/wiki/Ada_Programming/Object_Orientation#The_c...

Yes, this needs to be an access type. I need to store references to an
object, not the object itself. As far as I understand Ada this can
only be done via access types. Declaring a record member of type
"My_Interface'Class" is not possible. But even if it was it would
store a copy of the object, which would be incorrect and a waste of
memory.

> If so, does it need to be an access all? Read:
>
> http://en.wikibooks.org/wiki/Ada_Programming/Types/access#Access_vs._...
>
> Six month after I switched from C++ to Ada I removed about 80% access  
> types from the code I created until then. And from those access types  
> which remained more did not need the "all" and I consequently removed that  
> as well.

"Access all" will allow me to pass references to aliased objects.
Right now there is no reason to disallow that, so I'll keep the "all".



  parent reply	other threads:[~2008-10-29 12:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-24 11:45 How to pass around access types to interfaces? Sven
2008-10-24 12:24 ` Niklas Holsti
2008-10-24 12:49   ` Sven
2008-10-24 13:55     ` Ludovic Brenta
2008-10-24 21:32 ` sjw
2008-10-25  8:54   ` Sven
2008-10-25 15:43 ` Martin Krischik
2008-10-25 22:15   ` Robert A Duff
2008-10-26  8:02     ` Dmitry A. Kazakov
2008-10-26 15:50     ` Martin Krischik
2008-10-28 13:41       ` Maciej Sobczak
2008-10-29 14:15         ` Martin Krischik
2008-10-31 13:38           ` Maciej Sobczak
2008-10-31 14:46             ` Dmitry A. Kazakov
2008-10-29 12:42   ` Sven [this message]
2008-10-29 13:17     ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox