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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: limited agregate and limited components default initialization Date: Mon, 2 Apr 2018 21:59:17 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <853b698c-204b-4a5e-a486-b2d7cb664b3a@googlegroups.com> <4834a1b9-6ae2-4806-8022-02bbcc88765f@googlegroups.com> <0db6a65f-9c14-483d-98f9-9fa40e37253f@googlegroups.com> NNTP-Posting-Host: kQkuQcRDy1QFvWpyB1foYw.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:52.0) Gecko/20100101 Thunderbird/52.6.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:51303 Date: 2018-04-02T21:59:17+02:00 List-Id: On 2018-04-02 21:46, Jere wrote: > 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). Usually I do, it makes operations faster and easier because links are never null. I can even have not-null constraint on the links. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de