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,e511f3ccb3da24af X-Google-Attributes: gid103376,public From: "Robert I. Eachus" Subject: Re: How to make like Fortran "do i = 1,20,2" Date: 2000/07/29 Message-ID: <39823851.5837D694@earthlink.net>#1/1 X-Deja-AN: 652027773 Content-Transfer-Encoding: 7bit References: <8lpcbe$40n$1@news.uit.no> <39805669.3E7CF6CF@lmtas.lmco.com> <7rhf9bb362.fsf@butter.albany.duck.com> <3981A390.A1F3D127@lmtas.lmco.com> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 964835385 63.24.55.123 (Fri, 28 Jul 2000 18:49:45 PDT) Organization: The MITRE Corporation MIME-Version: 1.0 NNTP-Posting-Date: Fri, 28 Jul 2000 18:49:45 PDT Newsgroups: comp.lang.ada Date: 2000-07-29T00:00:00+00:00 List-Id: Ehud Lamm wrote: > One of the nice things about programming is that you can choose from > different languages. If you find Ada a bad language - use something else! > > I usually find myself in agreement with the desginers of Ada. Sometimes > though, reaching this conclusion takes time and refelction. Let's reflect a bit then. First, as pointed out elsewhere almost all for loops in whatever language step by one. The second most popular loop index, but way behind, is minus one. All other loop indexes in languages where you have arbitirary choices used to add up to less than the number that used -1. So if variable step sizes were allowed in Ada they would have been used very rarely. But just coming up with definitions for the feature is very problematical. For example, how many times should the following loops be executed (pseudo, but very definitely illegal, Ada): for I in 1..12 step 5 loop for I in 0.1..1.0 step 0.03 loop for I in Character range 'A'..'Z' step 3 loop for I in reverse Integer step -Integer'Last loop for I in 1..100 loop I := I+2; end loop; I could go on, but you get the picture. For Algol 68 I bet Robert Dewar can answer all those questions off the top of his head. There are probably readers of this newsgroup that know the answers for most version of Fortran, and I know the answers for PL/I. And I bet thatt least one answer for each language would surprise most of the readers of this newsgroup. My point is not that those languages are bad or wrong. But the focus on appropriate data typing in Ada meant that the effort of defining such rules, reviewing them, implementing them, and learning and teaching them was better spent on other, more useful features in Ada. For example, the ability to constrain one bound of a subtype, or one dimension of an array would be much more useful, and in the "spirit" of Ada. But even there I think that the overall cost of adding the feature would not match its benefit. (However, if anyone wants to discuss this, as far as I can tell allowing such constraints only in the type declaration would gain most of the benefit and not be too disruptive of the current language. The problem for arrays only shows up if you want a constrained dimension before an unconstrained dimension, since you can declare an unconstrained array of constrained arrays in Ada, but not the reverse.)