Sujet : Re: question about linker
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 12. Dec 2024, 15:56:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjeti4$2675b$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 24 25 26 27 28 29 30
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 12.12.2024 13:11, bart wrote:
On 11/12/2024 16:24, Janis Papanagnou wrote:
[...]
>
Concerning "C"; I don't see why you shouldn't name a "positive"
conditioned control construct consistently(!) as 'while' whether
it controls a loop entry or a loop exit, and to name a "negative"
conditioned control construct consistently(!) as 'until'.
I sometimes use 'when' for positive rather than 'if', and 'until' or
'unless' for negative.
Fair enough.
So you are saying that you'd prefer to use more than one keyword
for any positive and for any negative conditioned loop to prevent
you from any confusion?
My experience on that is that language designers usually try to
avoid to introduce too many keywords [unnecessarily].
(Or just use a 'not' prefix for negative, but for this purposes, it's
more helpful it having low precedence rather than high, to avoid
parentheses around the whole thing.)
I'm sure that's the reason why for example Pascal has just two
loop types (check on entry and exit respectively) and force the
programmers to just negate the condition when necessary. It's
not different in "C", with its two loop types, only that it has
not introduced another keyword (for the same 'while' semantics).
The parenthesis thing you mention is something that annoys me;
that's why I'd prefer to have languages with 'while' and 'until'
controlled loops, both on entry and exit, for flexibility. (But
I cannot recall I've ever programmed in any language that would
support that. I'm using what the project standards require, and
what's available and sensible in projects where I can choose.)
In Unix shell it's different; you have only "on-entry" checks;
while ... ; do ... ; done
until ... ; do ... ; done
You'll have to "work around" that for conditions-on-exit; e.g.
while P ; do S ; done ## check on entry
while S ; P ; do : ; done ## [quasi] check on "exit"
(with an empty loop block in the latter case). - Folks familiar
with Algol 68 may have no problems with that form, to others is
may look unfamiliar or strange.
Janis
[...] (here I'm talking about my syntax);
>
[snip]