From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9ce5fb49dc74582f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!k70g2000cwa.googlegroups.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: generic question Date: 21 Nov 2006 10:14:10 -0800 Organization: http://groups.google.com Message-ID: <1164132849.967832.310430@k70g2000cwa.googlegroups.com> References: <1163959439.299036.129940@e3g2000cwe.googlegroups.com> <87mz6nnt4v.fsf@ludovic-brenta.org> <20061119202320.19149a2f@cube.tz.axivion.com> <4560D5BE.5060508@obry.net> <1164059458.442430.110710@j44g2000cwa.googlegroups.com> <4562a51a$0$27404$ba4acef3@news.orange.fr> <45633396.10704@obry.net> NNTP-Posting-Host: 66.162.65.129 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1164132855 1601 127.0.0.1 (21 Nov 2006 18:14:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 21 Nov 2006 18:14:15 +0000 (UTC) In-Reply-To: <45633396.10704@obry.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k70g2000cwa.googlegroups.com; posting-host=66.162.65.129; posting-account=Zl1UPAwAAADEsUSm1PMMiDjihtBlZUi_ Xref: g2news2.google.com comp.lang.ada:7619 Date: 2006-11-21T10:14:10-08:00 List-Id: 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.