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:aed:2259:: with SMTP id o25mr2258738qtc.55.1569324209132; Tue, 24 Sep 2019 04:23:29 -0700 (PDT) X-Received: by 2002:a9d:7407:: with SMTP id n7mr1386300otk.16.1569324208927; Tue, 24 Sep 2019 04:23:28 -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!o24no4312719qtl.0!news-out.google.com!x7ni1572qtf.0!nntp.google.com!o24no4312715qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Sep 2019 04:23:28 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.223.245; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.223.245 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Implementing Rust's borrow checked pointers From: Optikos Injection-Date: Tue, 24 Sep 2019 11:23:29 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57179 Date: 2019-09-24T04:23:28-07:00 List-Id: On Tuesday, September 24, 2019 at 4:05:45 AM UTC-5, Lucretia wrote: > Hi, > > Been talking to someone on Telegraph and he was saying Ada should implement this, just wondering > whether Ada could? I posed a slight change to access type specification to do this, what do people > think? > > type P is restricted access X; > > Restricted in this case would mean that once assigned it cannot be re-assigned into or out of with out > some sort of move operation, which could be implemented as an attribute on the access type. > > A : P := L'Access; > B : P := A'Move; -- A cannot no longer be used. > > begin > A.all ... ; -- raises exception. No, to be as useful as Rust's borrow checker, instead of raising exception, it needs to be a compile-time error. The compiler needs to maintain a whole-program directed graph at compile-time, not defer a detection-based localized analysis to run-time. > I don't know enough about all this to put a complete proposal together, but I think I've got the basics > understood. > > Luke.