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: 10d15b,d730ea9d54f7e063 X-Google-Attributes: gid10d15b,public X-Google-Thread: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public From: adam@irvine.com (Adam Beneschan) Subject: Re: C is 'better' than Ada because... Date: 1996/08/20 Message-ID: <4vb5st$b5r@krusty.irvine.com>#1/1 X-Deja-AN: 175219381 references: <4 <4vb399$kt8@mtinsc01-mgt.ops.worldnet.att.net> organization: /z/news/newsctl/organization newsgroups: comp.lang.ada,comp.lang.c,comp.lang.cobol Date: 1996-08-20T00:00:00+00:00 List-Id: Craig Franck writes: >The point I was tring to make is you can write bad code in any >language. Good programmers and software support are as important >as the language. Puting training wheels on a language by being >able to write : FOR I IN Data 'RANGE LOOP > Put(Data(I), 3); > END LOOP; >because programmers can't count, may be helpfull. I haven't been following this "Thread That Will Not Die", so maybe I don't understand the context in which this statement occurs. It seems to me, though, that the poster is referring to 'RANGE as "training wheels" designed to protect inexperienced programmers from accidentally typing the wrong loop limit. This is ridiculous and shows a complete lack of understanding of software engineering principles. The whole purpose of 'RANGE, 'FIRST, 'LAST is for *maintainability*. It's there so that if you later decide to change the bounds of Data, you can do so in ONE PLACE (the place where Data is declared) without affecting the correctness of the rest of the program. Having the same information in two or more places in the program has long been recognized as a major source of errors introduced during maintenance. That is, if you say Data : array (1 .. 3) of whatever; . . . for i in 1 .. 3 loop Put (Data (i), 3); end loop; the lower and upper limits (1 and 3) are information that occurs in two places. Not a good idea; if you change one and forget to change the other, your program suddenly doesn't work any more. In fact, I'd consider an Ada programmer that coded the above loop to be an inexperienced one. I've been programming for 20 years, 8 years in Ada, and I would ALWAYS use the 'RANGE construct that this poster denigrates. It is *not* a "training wheel." -- Adam