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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c08a7609345f4e5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!postnews.google.com!i5g2000yqe.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Limited use for limited with? Date: Tue, 28 Sep 2010 05:59:59 -0700 (PDT) Organization: http://groups.google.com Message-ID: <36e886fa-b272-461f-bf86-a6b18366b64f@i5g2000yqe.googlegroups.com> References: <853314bc-0f79-435f-86a5-d7bcdd610731@c10g2000yqh.googlegroups.com> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1285678799 22720 127.0.0.1 (28 Sep 2010 12:59:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Sep 2010 12:59:59 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i5g2000yqe.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14292 Date: 2010-09-28T05:59:59-07:00 List-Id: On 28 Wrz, 11:18, Ludovic Brenta wrote: > I generally think twice or three times before declaring an access type > in the same package as the object type. In fact, I think twice before > declaring any access type at all :) So let's say that I already did the thinking and the most prevalent use case for access types is callback registration. Think about AWS dispatchers for the closest analogy. In fact, the AWS.Server.Start procedure has a version that takes the callback by access. It is an access to function, but I need it to be object-oriented. Hiding the use of access values behind the scenes (by virtue of tagged types being always passed by reference) would obstruct the code without clear benefit. This is what AWS does in its other versions of Start, but I don't like it. I want to express this: 1. Object is an interface type for the callback that will be implemented by user. 2. Object_Access is a type that will be used for declaring and passing around callback references. I don't want everybody to define their own types for what is a common functionality. I totally agree that in Ada the pressure for using access values is much smaller than in C++, but object registration (in a map, perhaps) is not addressed by any other language feature. BTW - it is exactly for the fact that there is little need for dynamic allocation that Object_Access has to be "access all" and not just "access". Should I drop the Object_Access type altogether and mess with locally- defined access types in other parts of the code? -- Maciej Sobczak * http://www.inspirel.com