Sujet : Re: Loops (was Re: do { quit; } else { })
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 16. Apr 2025, 06:39:11
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vtnfq1$1gobs$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 23
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 15.04.2025 18:42, bart wrote:
On 15/04/2025 17:22, Janis Papanagnou wrote:
On 15.04.2025 16:30, bart wrote:
On 15/04/2025 14:33, Kaz Kylheku wrote:
On 2025-04-15, bart <bc@freeuk.com> wrote:
* Not having to write the variable 3 times (with C not always
being
able to detect if they didn't match)
>
This is indeed a source of errors in C nested loops.
>
According to Janis Papanagnou, it is 100% the programmer's fault. There
is nothing wrong with the language!
>
No, there is nothing wrong with the language if you make such errors.
>
The programmer selects (or constructs) the algorithm, the language has
clear semantics for such simple loop constructs without any irregular
or hidden semantics, and the programmer's task is to know the elements
of the language and transfer the algorithm to a correct coding. - It's
self-delusion if you try to blame the language for the mistakes you do.
Suppose you have two ways A and B to implement a feature in a language.
You find that those using A tend to make twice as many mistakes in that
feature, and have more undetectable bugs, as those who use B.
Your job is to choose which of A and B to keep.
Would your decision completely ignore such findings?
We have a couple decisions to make, some factors are often predefined.
The necessary and possible decisions are made on different levels
depending on the role you have in a software project.
If I'd have a choice in the used language I might or might not use "C"
depending on the requirements to fulfill.
To be concrete; it's unlikely that I'll use Algol 68 or "your language"
and it had been the case that we had to use languages like C++ or Java.
If I have a choice in the participating programmers I would certainly
select those programmers that don't program by copy/paste and fail to
create correct code even in trivial cases like 'for' loops.
To be concrete for the factors exposed here; I would not select you for
the programming team; more often than not I see you only complaining
and having issues with understanding of (commonly known) programming
and programming language aspects.
As a pure programmer with a given environment I would use the features
of a language that appears most appropriate. You, OTOH, will obviously
be helpless since you fail even with simple loops in "C" - since that's
what "C" provides as control constructs for loops.
Janis