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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Overloading operator "=" for anonymous access types? Date: Thu, 17 Jan 2019 09:23:27 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <167dc83d-daac-49eb-ba79-48866ccde39d@googlegroups.com> <0c56d9f4-8861-4c74-b170-a973e3789b08@googlegroups.com> <252afc47-fe7d-41bc-b394-0735e1fd2e4c@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 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader01.eternal-september.org comp.lang.ada:55291 Date: 2019-01-17T09:23:27+01:00 List-Id: On 2019-01-17 04:20, Jere wrote: > I mostly find myself using them in situations where I need to save an > access variable of an object that doesn't live as long as the access > type involved. I can't do that safely with named access types. For > example, using them in containers (need the access type for iterators, > cursors, etc.) Actually access discriminant meant to be long living, a mix-in hack to avoid multiple inheritance implementation. > but creating those container objects inside an operation > of some form. I feel like having to use Unchecked_Access somewhat > defeats the purpose of using Ada (not all of it, just some). That is yet another hack. You should have been able to use a limited type object as a discriminant straight away without pointers. The situation is just same as with access to subprogram types. You would not need them most of the time, if you could pass subprogram as a parameter. > Are there any plans to add smarter and more relaxed named access types > in the future? Something akin to rust references (especially with > the recently released non lexical lifetimes update)? It's definitely > possible to track references in such a way though I wouldn't claim > it was easy to do. There is no need in an access type in these situations, why naming it? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de