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!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!gegeweb.org!news.ecp.fr!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Implicit dereferences rational question Date: Tue, 20 May 2014 16:26:08 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <1pkkrdwu7lh6y.7cjyncdfw33e.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1400621169 8541 69.95.181.76 (20 May 2014 21:26:09 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 20 May 2014 21:26:09 +0000 (UTC) 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.6157 Xref: news.eternal-september.org comp.lang.ada:19943 Date: 2014-05-20T16:26:08-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1pkkrdwu7lh6y.7cjyncdfw33e.dlg@40tude.net... > On Mon, 19 May 2014 16:51:56 -0500, Randy Brukardt wrote: > >> "Victor Porton" wrote in message >> news:llb1aa$gth$1@speranza.aioe.org... >>> Robert A Duff wrote: >>>> Victor Porton writes: >>>> >>>>> Why implicit dereferences use only access discriminants, not arbitrary >>>>> access fields? >>>> >>>> It helps prevent dangling pointers. >>> >>> In which way limiting to discriminants may prevent dangling pointers? >> >> Discriminants have a lengthy set of accessibility rules, which turn out >> to >> be exactly what's needed for limiting dangling pointers. In particular, >> it's >> almost never the case that one can make a copy of an access discriminant, >> while that's easy for a "arbitrary access field". > > Except that dereference, be it implicit or explicit, does not create > pointers. Obviously, it eliminates a pointer, as the name suggests. I suppose, but you have to have a pointer or something very similar to a pointer if you want to be able to write to it. And that's the key feature here: that one can use these as variables as well as constants. It didn't make much sense to invent a new, almost pointer construct just for this purpose when we already had one with the correct semantics. Randy.