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: border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!pit-in1.telstra.net!news.telstra.net!feeder.erje.net!us.feeder.erje.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Dereferencing and style guides Date: Fri, 11 Oct 2013 08:52:59 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <5249ab97$0$6625$9b4e6d93@newsspool2.arcor-online.net> <23baa71a-6293-452c-89de-16052a198d20@googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1381495979 15535 192.74.137.71 (11 Oct 2013 12:52:59 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 11 Oct 2013 12:52:59 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:hSCH9GNo9hU1OlXzuIUJ9+XDGOc= Xref: number.nntp.dca.giganews.com comp.lang.ada:183610 Date: 2013-10-11T08:52:59-04:00 List-Id: Bill Findlay writes: > Can I make the contrary case? Certainly. > Given that we know that P is a pointer, P.f or P(i) can only reasonably be > interpreted as dereferencing P and selecting a component from the result; so > I do not see that P^.f or P^(i) improves comprehensibility to any > significant degree. > > Given that we do not know that P is a pointer, P.f or P(i) is essentially > the same cognitive burden as R.f or A(i); from the uniform referent point of > view this is an advantage. It fails to be, only if the dereference fails, > and we know that that should not happen in Ada 8-). Even if it does, the > extra effort of perceiving the semantics correctly is trivial. By "dereference fails", I assume you're talking about null pointers. I wasn't so worried about that -- I'm more worried about aliasing. I'm thinking "X^.Y := ..." is a helpful reminder that some other pointers might also point to X^. So I'm not convinced. But I guess your point of view is more popular than mine. Consider languages like Java, for ex, where (almost) everything is a pointer, greatly (IMHO) exacerbating the aliasing problem. A pure functional language would be different: there, the semantics of "a thing" and "a pointer to a thing" are indistinguishable, so there's no reason to have explicit dereference operators. - Bob