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!aioe.org!.POSTED.w9ccYhHqE4Q004/5heo3Ew.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Implementing Rust's borrow checked pointers Date: Tue, 24 Sep 2019 19:56:29 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <5edf39fb-169a-463a-b28e-ece1d3b553e0@googlegroups.com> NNTP-Posting-Host: w9ccYhHqE4Q004/5heo3Ew.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cancel-Lock: sha1:ybqL5FKacX5UUkKnb5y4vRlFrBM= X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:57184 Date: 2019-09-24T19:56:29+01:00 List-Id: Lucretia writes: > On Tuesday, 24 September 2019 12:23:30 UTC+1, Optikos wrote: > >> > 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. > > Yes, the compiler would raise that exception at compile time. This > idea that all exceptions are raised at runtime is false and you should > check the AARM. GNAT could (guessing here, but following the way it handles CE detected at compile time) raise a *warning* to the effect that an exception ould be raised at run time. And if compiling with warning => error (-gnatwe) that would do the job. To an extent.