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!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Intervention needed? Date: Tue, 19 Mar 2019 17:13:18 -0500 Organization: JSA Research & Innovation Message-ID: References: <6e1977a5-701e-4b4f-a937-a1b89d9127f0@googlegroups.com> <6f9ea847-2903-48c8-9afc-930201f2765a@googlegroups.com> Injection-Date: Tue, 19 Mar 2019 22:13:19 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="11127"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader01.eternal-september.org comp.lang.ada:55899 Date: 2019-03-19T17:13:18-05:00 List-Id: "Optikos" wrote in message news:f4eee526-e607-4e1f-843f-9913c9c093f9@googlegroups.com... ... >Absolutely not. The cursor cannot dangle after the finalization of the >container. >No dangling after container-finalization means no dangling-of-cursor at >all. Q.E.D. Baloney. The cursor object still exists, and someone can still try to use it. Yes, you'll get an exception rather than erroneous execution, but it is still dangling (the term in the RM for cursors is "invalid"). (And note that there are cheaper ways to get that effect.) The whole point of the Rust scheme as I understand it is to avoid such things. In particular, you can never have a pointer with multiple owners. The "borrow" scheme as I understand it allows the owner to be temporarily transfered (so you can walk lists, for instance), but long-term storage of such pointers is simply not allowed. You can't build a cursor that way (nor a doubly-linked list). Perhaps the Rust people have gone beyond simple borrow semantics -- I don't know. Tucker's latest proposal lets one build cursors, but it can't detect changes where the owner of a node is changed after the fact (think of an operation like a list Splice where nodes are moved from one list to another). To do that would require putting a lot of restrictions on how an ADT is used, again something that cannot be done with the existing containers (and it's unclear that that is a good idea anyway, since it is leaking implementation characteristics to usages). Randy.