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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: little precision about anonymous access types Date: Fri, 18 May 2018 09:44:17 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <42387d28-c983-4e58-9522-815ccd1ad0fb@googlegroups.com> <6c1e643d-b826-4b8b-b61c-13c56428ed23@googlegroups.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:52423 Date: 2018-05-18T09:44:17+02:00 List-Id: On 17/05/2018 23:17, Randy Brukardt wrote: > "Mehdi Saada" <00120260a@gmail.com> wrote in message > news:d294e4a5-864c-4ab0-bf60-6c9a94ace651@googlegroups.com... >> So if it was you, you would have treated subprograms with >> access types parameters as primitives, as long as they are declared >> in the same immediate scope ? It sounds simple, why hasn't it be >> do that way ? > > No, I wouldn't bother with dispatching on access values at all. Since Ada > passes all tagged objects by reference, and 'Unchecked_Access is always > allowed on tagged parameters, it's always possible to get an access to a > tagged parameter if that is needed. There's no reason to *pass* that value - > just pass the tagged object. You forgot the return. Return by reference was killed and there is no substitute for function Foo return access T; > Essentially, there's no implementation difference (ignoring the abomination > of dynamic accessibility) between "access T" and "in out T" for a tagged > type T. Yes, but there must be difference if the type system were fixed to allow classes of non-tagged and by-value objects. I agree that controlling access T could be made superfluous by carefully designed references. I also believe that having an operation for T and not having it for access T and conversely is not good. I.e. if there is procedure Foo (X : in out T); then that must automatically define procedure Foo (X : access T); and conversely. Rules for automatic dereferencing do this in some cases. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de