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!feeder.eternal-september.org!aioe.org!.POSTED.fn3LatRFkm9/xzEj7F2/NQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Intervention needed? Date: Tue, 19 Mar 2019 09:44:14 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <6e1977a5-701e-4b4f-a937-a1b89d9127f0@googlegroups.com> <6f9ea847-2903-48c8-9afc-930201f2765a@googlegroups.com> NNTP-Posting-Host: fn3LatRFkm9/xzEj7F2/NQ.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:60.0) Gecko/20100101 Thunderbird/60.5.3 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:55895 Date: 2019-03-19T09:44:14+01:00 List-Id: On 2019-03-19 03:18, Optikos wrote: > On Monday, March 18, 2019 at 7:36:17 PM UTC-4, Randy Brukardt wrote: >> since the containers are designed with possibly dangling cursors, a totally >> safe system would not be usable with them. The containers do include checks >> that would detect many ownership problems, however, so any lack of >> compile-time safety is definitely mitigated. (It's not 100% safe because of >> the possiblity that a cursor outlive the owner object; in that case, the >> checks are unreliable.) > > A container could have (as a required fundamental axiom) a singly-linked list of spirits of all cursors ever created that reference it. As each cursor's life ends, that dying cursor directly knows O(1) where its spirit is within that linked list, and then removes its dying spirit too. Then as the lifetime of the container ends, the finalization of that linked list is to walk that link-list of spirits to abruptly undermine each spirit's corresponding still-living cursor so that that longer-lived-than-its-container cursor abruptly has the usual customary representation of cursor-exhausted-its-walk-of-the-container (i.e., the end-of-loop criterion during normal-operations' not-end-of-lifed cursor walks of not-end-of-lifed container), so that cursors are all instantly loop-terminating gracefully whenever their container ceases to exist. Forgive my ignorance, but how this is different from a weak reference? > Hence, no cursor ever contains a pointer/access/address value that out lives its container, because that pointer was overwritten (at container finalization) with the cursor-exhausted-its-walk-of-the-container reserved value that all loops & conditional branches interrogate as a matter of their normal-operations behavior. Q.E.D. The cursor is still dangling. The difference is that one can check if it indeed is (with a nice race condition attached). -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de