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,XPRIO 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: Mon, 25 Mar 2019 14:14:36 -0500 Organization: JSA Research & Innovation Message-ID: Injection-Date: Mon, 25 Mar 2019 19:14:37 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="26810"; 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:55963 Date: 2019-03-25T14:14:36-05:00 List-Id: "Jere" wrote in message news:735761d5-f917-4477-9b0a-e0cde1ce2440@googlegroups.com... > On Saturday, March 23, 2019 at 3:53:34 AM UTC-4, Randy Brukardt wrote: ... > If you were instead referring to indexing the container, for things > like vector, Rust looks to see if the container implements the Index > trait, and, if so, allows for the user to use the index operation > on the container. It's very similar to making a cursor and setting the > variable_indexing aspect and constant_indexing aspect, except rust doesn't > expose the underlying equivalent cursor type. So you either work > with Indexes or Iterators depending on your need. I was specifically asking about the common need to have connections between containers. It's not likely that a single container is all one needs to solve a problem, so one needs ways to refer to elements of one container from another. For instance, one might need a index for another container. (For instance, to allow lookups by some internal characteristic.) If the main container is structured (as in an internal representation of HTML or XML, or a compiler symbol table), the index has to be a separate container. Ada provides cursors to represent those sorts of interconnections. How does Rust do it?? (If it does it at all.) This sort of thing comes up any time that one has two separate data structures that are inter-related. Sometimes you can use composition for combining structures (and that's preferable when possible), but if there are potentially multiple references to a single item or if the element is just part of a larger data structure, composition doesn't work and some sort of reference is needed. Randy. P.S. Sorry about breaking the thread; the message wouldn't post because of header limits (too many replies).