comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: generic question
Date: 21 Nov 2006 10:14:10 -0800
Date: 2006-11-21T10:14:10-08:00	[thread overview]
Message-ID: <1164132849.967832.310430@k70g2000cwa.googlegroups.com> (raw)
In-Reply-To: <45633396.10704@obry.net>


Pascal Obry wrote:
>
> You are saying that for every anonymous access type you need to declare
> a named access type from which allocate/deallocate.

Yes, to implement the factory function and destructor for a (tagged)
type.  But that's internal to the package that declares the tagged
type.  The factory function (called by a user of the package to create
instances of this specific type) should return an anonymous access type
as its return type.

If this is a non-tagged type, then anonymous access types are less
necessary, since there's no need for type conversions (as would be the
case for tagged types in a class).


> One point of the
> anonymous access type was to avoid proliferation of named access type...

No.  When you're doing object-oriented programming with different types
in a tagged type hierarchy, you need to be able to easily convert among
specific types and class-wide types towards the root of the hierarchy.
This is simpler with anonymous access types since the conversions are
implicit.

> I find anonymous access type less useful this way... Why even bother
> with them then ?

So that conversions towards the root of a tagged type hierachy are
implicit.  If you were to use named access types to convert towards the
root then this is crying wolf.  You want to reserve explicit
conversions for those times when you want the reader to take notice
that something special is going on, which is the case when performing a
down-cast, away from the root.




  parent reply	other threads:[~2006-11-21 18:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-19 18:03 generic question markww
2006-11-19 19:17 ` Ludovic Brenta
2006-11-19 19:23   ` Stefan Bellon
2006-11-19 20:16     ` markww
2006-11-19 22:07     ` Pascal Obry
2006-11-20 10:35       ` Alex R. Mosteo
2006-11-20 17:03         ` Pascal Obry
2006-11-20 18:10           ` Alex R. Mosteo
2006-11-20 21:16             ` markww
2006-11-20 21:40               ` Matthew Heaney
2006-11-20 21:50       ` Matthew Heaney
2006-11-21  7:04         ` Pascal Obry
2006-11-21  8:25           ` Alex R. Mosteo
2006-11-21 14:25             ` Matthew Heaney
2006-11-21 15:47               ` Matthew Heaney
2006-11-21 17:14                 ` Pascal Obry
2006-11-21 18:15                   ` Matthew Heaney
2006-11-21 18:28                     ` Dmitry A. Kazakov
2006-11-21 14:21           ` Matthew Heaney
2006-11-21 17:12             ` Pascal Obry
2006-11-21 17:25               ` Lutz Donnerhacke
2006-11-21 17:35                 ` Alex R. Mosteo
2006-11-21 18:18                 ` Matthew Heaney
2006-11-22 23:58                 ` Randy Brukardt
2006-11-23  8:32                   ` Dmitry A. Kazakov
2006-11-28 21:23                     ` Randy Brukardt
2006-11-29 15:57                       ` Matthew Heaney
2006-11-21 18:14               ` Matthew Heaney [this message]
2006-11-23  0:02                 ` Randy Brukardt
2006-11-21 18:17               ` Dmitry A. Kazakov
2006-11-21 18:32                 ` Matthew Heaney
2006-11-19 20:24 ` Jeffrey R. Carter
2006-11-19 20:33   ` markww
2006-11-20 17:31 ` Adam Beneschan
2006-11-21 16:22 ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
2003-11-23 20:59 shoko
2003-11-23 21:41 ` Marius Amado Alves
replies disabled

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