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 18:13:45 -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 23:13:46 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="25630"; 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:55905 Date: 2019-03-19T18:13:45-05:00 List-Id: "Optikos" wrote in message news:de2f5462-fa10-4fdf-97a6-99989e40c697@googlegroups.com... On Tuesday, March 19, 2019 at 6:13:20 PM UTC-4, Randy Brukardt wrote: >> Baloney. The cursor object still exists, and someone can still try to use >> it. Yes, you'll get an ...exception... rather than erroneous execution > >No, you have it all wrong ...there.... Not raise an exception, but rather >gracefully take the end-of-walk branch of code, just as in normal >operations. Walking is only a small portion of the usage of cursors, and IMHO it is the least important one (since everyone other than container developers ought to be using iterators to walk their containers). A cursor is a handle accessing an element of a larger container, nothing more or less than that. The primary usage is to connect data structures made up of multiple containers. For instance, consider a compiler symboltable. There is a tree structure that represents each of the declarations and their scopes, and a map structure that represents a mapping of names to nodes of the treee. The contents of that map is going to be tree cursors, each representing a declaration with a particular name. In such a structure, it would be common to assume that the cursors are valid (just like you would assume that pointers are non-null in such a case -- that's precisely what Janus/Ada code does, for instance). And dereferencing a cursor that points at a deleted node has to raise some exception (just as it would when using a pointer). The value of cursors is that they can be implemented by a range of abstractions with a range of checking, from array indicies (as in the bounded containers and the vector) to pointers with a variety of schemes from no dangling checking to the bulletproof controlled cursor scheme. In any case, the implementation of a cursor is irrelevant, since the Rust scheme doesn't allow making copies of pointers in the first place. Since you can't create a cursor with a pointer implementation, it becomes irrelevant as to how it is treated at end-of-life. Sadly, what I see here is someone who's so bought into Rust hype that they fail to consider the real trade-offs implicit in such a technology. There's no reason to bring the basic Rust scheme into Ada, since there is almost no reason in Ada to create such pointers in the first place (see my reply to Paul). Where everyone needs help is for complex data structures, and Rust (as I understand it, anyway) provides little help there. Tucker at least is trying to help with the issues associated with those sorts of structures, but it remains to be seen whether the proposal can get baked enough to get it into Ada 2020. Randy.