comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@earthlink.net>
Subject: Re: How to make like Fortran "do i = 1,20,2"
Date: 2000/07/29
Date: 2000-07-29T00:00:00+00:00	[thread overview]
Message-ID: <39823851.5837D694@earthlink.net> (raw)
In-Reply-To: Pine.A41.3.96-heb-2.07.1000729001045.79432A-100000@pluto.mscc.huji.ac.il

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.)




  parent reply	other threads:[~2000-07-29  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-27  0:00 How to make like Fortran "do i = 1,20,2" Reinert Korsnes
2000-07-27  0:00 ` Lutz Donnerhacke
2000-07-27  0:00 ` G. de Montmollin
2000-07-27  0:00 ` des walker
2000-07-27  0:00   ` Gary Scott
2000-07-27  0:00   ` tmoran
2000-07-28  0:00     ` Reinert Korsnes
2000-07-28  0:00       ` Gautier
2000-07-29  0:00       ` tmoran
2000-07-27  0:00 ` Ken Garlington
2000-07-27  0:00 ` Larry Kilgallen
2000-07-27  0:00   ` Gary Scott
2000-07-27  0:00     ` mjsilva
2000-07-27  0:00     ` Matthew J Heaney
2000-07-28  0:00       ` Gary Scott
2000-07-28  0:00         ` mjsilva
2000-07-29  0:00         ` Ehud Lamm
2000-07-28  0:00           ` Richard Riehle
     [not found]           ` <39833637.3B83BFAC@lmtas.lmco.com>
2000-07-29  0:00             ` Gary Scott
2000-07-29  0:00           ` Robert I. Eachus [this message]
2000-07-27  0:00     ` Pat Rogers
2000-07-27  0:00     ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox