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!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Getting the index for an element in mutually referencing containers Date: Thu, 16 Mar 2017 10:04:31 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <86o9xa36oq.fsf@gaheris.avalon.lan> <86k27xpikd.fsf@gaheris.avalon.lan> <86wpbxneuz.fsf@gaheris.avalon.lan> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 X-Notice: Filtered by postfilter v. 0.8.2 X-Mozilla-News-Host: news://news.aioe.org Xref: news.eternal-september.org comp.lang.ada:46403 Date: 2017-03-16T10:04:31+01:00 List-Id: On 2017-03-15 21:12, Randy Brukardt wrote: > "Dmitry A. Kazakov" 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