comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Overloading operator "=" for anonymous access types?
Date: Thu, 17 Jan 2019 09:23:27 +0100
Date: 2019-01-17T09:23:27+01:00	[thread overview]
Message-ID: <q1pe1u$199s$1@gioia.aioe.org> (raw)
In-Reply-To: 252afc47-fe7d-41bc-b394-0735e1fd2e4c@googlegroups.com

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

  reply	other threads:[~2019-01-17  8:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 21:46 Overloading operator “=” for anonymous access types? daicrkk
2019-01-12  9:50 ` Simon Wright
2019-01-12 14:01   ` Simon Wright
2019-01-12 15:15   ` daicrkk
2019-01-14 23:08     ` Overloading operator "=" " Randy Brukardt
2019-01-15  0:34       ` Shark8
2019-01-15  8:38       ` Dmitry A. Kazakov
2019-01-15 21:00         ` Randy Brukardt
2019-01-16 15:42           ` Dmitry A. Kazakov
2019-01-15  8:51       ` daicrkk
2019-01-15 11:15         ` Simon Wright
2019-01-17  3:20       ` Jere
2019-01-17  8:23         ` Dmitry A. Kazakov [this message]
2019-01-17 22:22         ` Randy Brukardt
2019-01-18 10:17           ` Dmitry A. Kazakov
2019-01-18 13:27           ` Jere
2019-01-18 13:42             ` Dmitry A. Kazakov
replies disabled

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