comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Getting the index for an element in mutually referencing containers
Date: Thu, 16 Mar 2017 10:04:31 +0100
Date: 2017-03-16T10:04:31+01:00	[thread overview]
Message-ID: <oadkev$121j$1@gioia.aioe.org> (raw)
In-Reply-To: oac779$ffo$1@franka.jacob-sparre.dk

On 2017-03-15 21:12, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:oaausp$ddn$1@gioia.aioe.org...
>> On 2017-03-14 21:40, Randy Brukardt wrote:
> ...
>> The problem is that the smart pointer type must be anonymous (ad-hoc) like
>> access T is. Otherwise, you get the problem of parallel type hierarchies
>> of the targets and the pointers. And the pointer type must have the
>> interface of the target AKA implicit dereference.
>
> The problem of parallel type hierarchies is one that MUST be solved if one
> is going to program with hierarchies. It IS fundamental to strong typing,
> unlike most of these other issues. We really need a solution to it (I've
> tried some and intend to try more).

I hope you will find something.

> I don't recall ever needing both "strong" or "weak" references to any data
> structure. Most structures only need short-lived references, and the ones
> that need long-lived ones are almost always permanent (only changed between
> runs). Maybe that's because when the only tool you have is an access type,
> every reference looks unchecked and dangerous. :-) But I doubt that many
> problems need or care about the both possibilities.

1. Say you have a tree. A parent holds references to its children. Each 
child holds a reference to its parent. One of these references must be 
weak or you get a circular lock.

2. Another example. Let you attach a monitoring object to the object 
that emits some events/callbacks. Neither may hold another. The monitor 
can take its leave so the object can. In this case both references are weak.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  parent reply	other threads:[~2017-03-16  9:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 13:45 Getting the index for an element in mutually referencing containers Mart van de Wege
2017-03-09 15:25 ` Egil H H
2017-03-09 15:45   ` Mart van de Wege
2017-03-09 16:02     ` Mart van de Wege
2017-03-09 16:11     ` Egil H H
     [not found] ` <ly7f3xedp4.fsf@pushface.org>
     [not found]   ` <86k27xpikd.fsf@gaheris.avalon.lan>
     [not found]     ` <lywpbxc9my.fsf@pushface.org>
     [not found]       ` <86wpbxneuz.fsf@gaheris.avalon.lan>
     [not found]         ` <o9vcbp$t0t$1@franka.jacob-sparre.dk>
2017-03-11  6:45           ` Mart van de Wege
2017-03-11  8:40           ` Simon Wright
2017-03-11  8:58             ` Dmitry A. Kazakov
2017-03-11 11:21               ` Simon Wright
2017-03-11 14:18                 ` Dmitry A. Kazakov
2017-03-11 20:05                   ` Simon Wright
2017-03-11 20:52                     ` Dmitry A. Kazakov
2017-03-11 21:46                       ` Simon Wright
2017-03-11 22:37                         ` Niklas Holsti
2017-03-12  8:22                           ` Simon Wright
2017-03-12  9:38                             ` G.B.
2017-03-12 11:21                               ` Simon Wright
2017-03-13 10:29                             ` Alejandro R. Mosteo
2017-03-12  8:20                         ` Dmitry A. Kazakov
2017-03-12 11:30                           ` Simon Wright
2017-03-12 11:55                             ` Dmitry A. Kazakov
2017-03-12 16:44                               ` Simon Wright
2017-03-12 17:42                                 ` Dmitry A. Kazakov
2017-03-13 19:55                                   ` Randy Brukardt
2017-03-13 20:53                                     ` Dmitry A. Kazakov
2017-03-14 20:40                                       ` Randy Brukardt
2017-03-15  8:44                                         ` Dmitry A. Kazakov
2017-03-15 20:12                                           ` Randy Brukardt
2017-03-16  2:59                                             ` Paul Rubin
2017-03-16  9:04                                             ` Dmitry A. Kazakov [this message]
2017-03-13 23:25                                   ` Simon Wright
2017-03-14  8:25                                     ` Dmitry A. Kazakov
2017-03-12  1:36             ` Randy Brukardt
replies disabled

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