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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.128.77 with SMTP id b74mr5044559iod.117.1522698418607; Mon, 02 Apr 2018 12:46:58 -0700 (PDT) X-Received: by 2002:a9d:4045:: with SMTP id o5-v6mr630151oti.6.1522698418541; Mon, 02 Apr 2018 12:46:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!u184-v6no4325038ita.0!news-out.google.com!u64-v6ni5612itb.0!nntp.google.com!u184-v6no4325036ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 2 Apr 2018 12:46:58 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.218.250; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.218.250 References: <853b698c-204b-4a5e-a486-b2d7cb664b3a@googlegroups.com> <4834a1b9-6ae2-4806-8022-02bbcc88765f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0db6a65f-9c14-483d-98f9-9fa40e37253f@googlegroups.com> Subject: Re: limited agregate and limited components default initialization From: Jere Injection-Date: Mon, 02 Apr 2018 19:46:58 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2657 X-Received-Body-CRC: 3607672604 Xref: reader02.eternal-september.org comp.lang.ada:51302 Date: 2018-04-02T12:46:58-07:00 List-Id: On Monday, April 2, 2018 at 2:51:00 PM UTC-4, Dmitry A. Kazakov wrote: > On 2018-04-02 20:19, Jere wrote: > > > Something else unrelated to your question, but that I just noticed: Assuming > > you could have gotten a list definition that you were happy with, there is > > still a very serious problem with it. Doubly linked lists (ones that use > > both Next and Prev/Pred) are susceptible to "circular references" when using > > reference counting smart pointers. You would need to use a weak reference > > based smart pointer for one of the two (either Next or Prev/Pred, whichever > > you prefer). > > > > -- very simple/silly example > > type Node is > > Value : Item_Type; > > Next : Smart_Pointer_Type; > > Prev : Weak_Smart_Pointer_Type; > > end Node; > > This is still circular. Weak/strong references work only in hierarchical > structures. If a doubly-linked list must deploy them then it should be > the head holding references to all nodes. It does not make much sense > though. > Nope, not circular at all unless you connect Tail to Head (which isn't the normal use case). The List type would hold a smart pointer to the head node. Been working flawlessly for over a decade now with no circular references.