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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56250291936154a0 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Where is the elusive jump command? Date: 2000/04/02 Message-ID: <8c668j$hv0$1@slb1.atl.mindspring.net>#1/1 X-Deja-AN: 605473336 References: <38D771CA.D41AF9B5@port.ac.uk> <8bq7ku$mc8$1@nnrp1.deja.com> <38E0E723.C39C392@quadruscorp.com> <8brfm4$4uc$1@nnrp1.deja.com> <8brn4k$p6i$1@slb0.atl.mindspring.net> <8brrpj$i04$1@nnrp1.deja.com> <8c088m$puh$1@slb6.atl.mindspring.net> Organization: MindSpring Enterprises X-Server-Date: 2 Apr 2000 01:03:15 GMT Newsgroups: comp.lang.ada Date: 2000-04-02T01:03:15+00:00 List-Id: In article , Robert A Duff wrote: >Richard D Riehle writes: > >> This could have been accomplished without the word _aliased_ >> keyword. Could it have been as easily checked by the compiler? > >Yes, because as Robert pointed out, the same analysis has to be done for >'Address, anyway. OK. So the same analysis must be done. That does not change the value of _aliased_ for the programmer writing the code. Knuth, as mentioned earlier, suggests that programming languages are designer for humans not for compilers. Ada is somewhere in between, I guess because many of the rules in the language are intended to enable the construction of more robust compilers. Also, I recall reading somewhere, perhaps the Rationale, that aliased was intended to be useful for the compiler writer so code optimizations could be anticipated. Perhaps this usage is now superseded by more clever compiler designs. >> It seems to me that _aliased_ helps prevent the very kind of >> errors one encounters in C. If the reserved word is not intended >> to provide special information to the compiler, why not just do >> this the same way we do it in C? > >Umm. Because the compiler isn't the one putting errors in the code -- >it's you and me. Exactly my point. And _aliased_ helps the compiler notice the errors we so generously contribute to the code. >"Aliased" is there for the human reader. It doesn't make the compiler >any simpler. In fact the compiler has to go to extra trouble to check >the rules. Bingo. Once again, right to the original point. That is what Ada is about, checking to ensure we have not violated some little rule. The question then, "Is this an unnecessary rule?" Should we simply let the compiler assume we are doing what we intended? >>...The fact is that I cannot use >> 'Access on a value that is not aliased. The compiler prevents it. >> Hence, I see this is as a signal to the compiler that I am trying >> to do something illegal. It is also a tip-off to the compiler that >> accessibility rules need to be enforced. > >Not really -- the accessibility rules are triggered by 'Access and type >conversions and so forth; the compiler doesn't need any "tipping off" in >this sense. OK. Granted that the accessibility rules are larger than the _aliased_ keyword. From the viewpoint of an applications developer, it seems that the _aliased_ keyword is essential. Very few of us, thankfully, are still writing compilers, so most of us look at this from the viewpoint of human beings trying to make code work. In fact, most of us don't care a whit about what it takes for the compiler to do its work. We simply want the rules applied correctly and consistently. >> Whatever the original intent of _aliased_ , it has the effect of >> letting the programmer know about the legality or illegality of a >> syntactic construct, ensuring that certain practices are avoided, >> and making it clear what one's intentions are in the source code. > >Right. Glad we can agree on this. From my perspective, this is an essential idea. My sentence, with which you seem to agree, probably applies to lots of other syntactic constructs in the language. Question: would the Ada language be just as effective without the _aliased_ keyword? Are there other keywords we could jettison in favor of simplicity? >>...Perhaps requiring the reserved word _aliased_ encourages the >> sparing use of it in source code. > >I've heard that sort of thing many times. I don't agree. A competent >programmer will use '[Unchecked_]Access on local variables exactly when >appropriate -- no more, no less. That's true whether or not you have to >mark things as "aliased". The point (IMHO) is not to encourage or >discourage things, but to make sure the *reader* of the code can easily >see what's going on. That makes very good sense. It takes us back to the issue of interaction between programmer and compiler, where the language is designed to improve clarity for the human reader of source code, not just for the compiler. This is in keeping with the spirit of Don Knuth's "Literate Programming," admonitions. It is also in compliance with what many of us see as the underlying goal of Ada: maximize the amount of checking a compiler can do as early in the development process as possible. That checking includes pummeling the programmer about the head and shoulders soundly for forgetting to include the _aliased_ keyword. Richard Riehle