Sujet : Re: Loops (was Re: do { quit; } else { })
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 15. Apr 2025, 05:14:09
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vtkmej$2ucjl$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 14.04.2025 23:44, Keith Thompson wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
(While there's some "C" stuff in here it contains a lot of non-"C"
samples for comparison. So [OT]-sensible folks may want to skip this
post.)
On 14.04.2025 12:16, bart wrote:
[...]
Fortran's loops looked like this:
>
do 100 i = a, b
s1
s2
...
100 continue
>
Okay, I see what you want; just two values (from, to).
>
This Fortran stuff looks really sick (for my taste)! - The "do 100"
sounds like iterating 100 times, line numbers, 'continue' keyword,
and a list a,b meaning iteration over a range. - Can it be worse?
(Later Fortran versions allow a slightly better syntax, but it's
basically the same anachronistic crude syntax.)
To any programmer familiar with that version of Fortran, the 100 doesn't
look like iterating 100 times. It looks like a label, and it's
reasonably consistent with other constructs that refer to labels. The
syntax isn't great, but don't judge an unfamiliar language syntax by one
example.
Not sure what you mean by "unfamiliar"; back these days it was quite
commonly known in the IT scene. Myself I programmed in Fortran during
the 1980's; that was enough to identify all its crudeness[*].
The Fortran language is not different than any other language in that
respect that you have to learn it, understand it, accept it, and then
use it. If you're judging any language from a design perspective then
it's good to overcome arguing just within the language but take into
considerations what other languages did and, with a step back, what
constructs are exposed to the one learning the syntax.
The "do 100 i = a, b" is from design perspective in principle not
different to, for example, the crude declaration details of "C". It's
not something that we would need to complain about given that Fortran
is very old. But advocating it is far off, especially in the light of
the back then next generation languages; Algol 60, Pascal, and so on,
including even that (old, crude) BASIC, which all offer more sensible
loop syntaxes to their programmers.
We don't need to judge Fortran by contemporary languages, it suffices
to compare it with the language generation following Fortran since the
1960's. (Or just use common sense.)
Janis
[*] But gladly not enough to not forget after four decades all the
really gory details.