Sujet : Re: Loops (was Re: do { quit; } else { })
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 20. Apr 2025, 15:34:51
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250420173451.000071f3@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Sun, 20 Apr 2025 14:53:54 +0100
bart <
bc@freeuk.com> wrote:
On 20/04/2025 12:00, Janis Papanagnou wrote:
Exactly 19 days ago I'd even have written such a proposal, and,
fitting to the calendar date, of course I'd have used a distinct
name for the feature; 'for_losers(var,expr,expr[,expr])'.
This is quite telling in that:
(1) You regard the idea of desiring such a feature as a joke
(2) You consider those who'd like to use it as 'losers'
Just such a feature seems to be the primary style of 'for' in
languages such as Ada, Python, Modern Fortran, Odin, Ruby, Julia,
Rust, Matlab, Algol68, Euphoria, Ocaml, Logo, Nim, PL/I, Haxe, Lua,
....
>
In majority of languages in your list 'for' loops iterates through all
elements of collection. If collection happens to be a range
(terminology shared by python and Rust) then 'for' behaves as a
counting loop. If it isn't then it does not. Even Matlab, despite its
fortranic roots, belongs to that group.
C++ achieve the same objectives [with typical C++ ugliness] by means
of std::foreach.
If I am not mistaken, all exception to that pattern are old languages.
>
Even Bash has it. All losers?
>
Not all, just many.
Interestingly, so does BCPL: you may be aware that C was influenced
by B, which itself was supposed to be influenced by BCPL. So what the
hell happened?
>
So, what happened?