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 X-Received: by 2002:a5e:cb01:: with SMTP id p1mr21304945iom.100.1553587750374; Tue, 26 Mar 2019 01:09:10 -0700 (PDT) X-Received: by 2002:aca:cc4e:: with SMTP id c75mr14572192oig.7.1553587750222; Tue, 26 Mar 2019 01:09:10 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!w126no150971ita.0!news-out.google.com!l81ni162itl.0!nntp.google.com!78no150746itl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 26 Mar 2019 01:09:09 -0700 (PDT) In-Reply-To: <735761d5-f917-4477-9b0a-e0cde1ce2440@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=96.255.209.31; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 96.255.209.31 References: <6e1977a5-701e-4b4f-a937-a1b89d9127f0@googlegroups.com> <6f9ea847-2903-48c8-9afc-930201f2765a@googlegroups.com> <74339f3f-9591-45a3-8632-8834b4b466ab@googlegroups.com> <5be8a4cc-84de-4716-9f0c-10907f451312@googlegroups.com> <735761d5-f917-4477-9b0a-e0cde1ce2440@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <82a72484-3a0c-4e91-9bb9-94ca8ded1cb7@googlegroups.com> Subject: Re: Intervention needed? From: Optikos Injection-Date: Tue, 26 Mar 2019 08:09:10 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:55967 Date: 2019-03-26T01:09:09-07:00 List-Id: On Saturday, March 23, 2019 at 9:59:38 AM UTC-4, Jere wrote: > On Saturday, March 23, 2019 at 3:53:34 AM UTC-4, Randy Brukardt wrote: > > "Jere" wrote in message=20 > > ... > > > Not really. In Rust they don't even use cursors. They go straight t= o > > > iterators. On top of that, the combination of being able to specify = the > > > lifetime of all of your variables (if you need to) and the ownership = rules > > > gives them 100% safety from dangling references when they create and = use > > > those iterators. > >=20 > > If you don't store any cursors and just use iterators in Ada, you have = the=20 > > same level of safety: the tampering checks prevent any problems with=20 > > iterators. (Well, unless you turn them off, of course, but if you remov= e the=20 > > seatbelts, you can't much complain that they didn't protect you.) > >=20 > > I'd be interested to find out how Rust deals with the need to designate= =20 > > individual elements of a container (which is the primary reason that Ad= a=20 > > exposes cursors). > >=20 > > Randy. >=20 > Keep in mind the rust paradigm is very different than Ada's. When you > obtain an iterator of a container, you borrow ownership of the container. > At that point it is impossible to tamper with the container because it > is a compile time error to modify the container when something else has= =20 > ownership of it. It's a compile time version of Ada's tampering checks > using an ownership model. If you need to remove items as you iterate,=20 > there is a consuming version of the iterator that allows for that. It > handles all the logic of keeping the iterator correct as you remove > items. If you need to remove only specific items, it provides=20 > functions for that as well (but you would not iterate while using=20 > them do to the ownership/borrowing rules). >=20 > Additionally, Rust allows you to specify the lifetime of the iterator,=20 > the lifetime of the reference to the item, and how they relate to the > lifetime of the container so that the compiler can guarantee that > nothing dangles (it's a relative specification..container has lifetime=20 > A and everything else has either A or a lifetime relative to A). This overt specification of lifetime (vis a vis Ada's multiple fixed assump= tions of lifetime) seems to be Rust's key innovative contribution that Ada = lacks. An analogous key contribution to humankind is that ATS2 and ATS3 ba= se their guaranteed no-dangling-pointer correctness on =E2=80=9Ctype* views= =E2=80=9D (and their type@address primitives in =E2=80=9Cviewtypes=E2=80=9D= ) which are quite different syntactically than Rust's overt specification o= f lifetime but in the end provide to ATS a direct measure of extent of life= time implied by (and directly derived from) what depending on what for how = long. * What ATS calls type is a branch of type-theory from higher mathematics. = What we call type in programming is generally called =E2=80=9Csort=E2=80=9D= in ATS, where ATS's usage of sort has the meaning of =E2=80=9Ckind=E2=80= =9D or =E2=80=9Ccategory=E2=80=9D as in =E2=80=98what sort of programmer ar= e you?=E2=80=99, but ATS's usage of sort does not have the meaning of =E2= =80=9Corder arrangement=E2=80=9D as in the SQL-statement clause SORT.