Re: OT: The REAL RIddle of DO LOOPS Solved



By logical extension, if the initial value is GREATER than
the STOPPING value, the default step size should be -1,
to be consistent with the "+1" convention, in context.

[Not the] ... ARBITRARY convention adopted by the new
ANSI -- to the detriment of violating sound LOGIC and
consistency.

When encountering the instruction FOR X = A TO B where A > B then
surely the 'logical' and 'consistent' thing for a programming language
from the 60s would be to set X to A and then increment until the value
wraps round to B.

Facetiousness aside: When encountering ambiguity, rather than guess
what I meant using 'logical extension' (which in some contexts may not
be logical, depending on what A and B actually represent) I would
rather programming languages have simple, unconditional behaviours and
respond to ambiguity by throwing an error, requiring me to be more
explicit. After all the ambiguity may as easily have arisen from a
design or programming error.

In particular, since BASIC has an optional STEP statement that would
allow me to explicitely implement conditional 'reverse' stepping (e.g.
STEP SIGN(B-A)) then it shouldn't be guessing that this is what I
wanted even though I didn't ask for it. Anything less is sloppy
language design that encourages sloppy programming.

.



Relevant Pages

  • Re: OT: The REAL RIddle of DO LOOPS Solved
    ... to be consistent with the "+1" convention, ... surely the 'logical' and 'consistent' thing for a programming language ... When encountering ambiguity, ... have worked if that's an allowable explicit statement for STEP. ...
    (sci.stat.math)
  • Re: OT: The REAL RIddle of DO LOOPS Solved
    ... to be consistent with the "+1" convention, in context. ... surely the 'logical' and 'consistent' thing for a programming language ... When encountering ambiguity, ...
    (sci.stat.math)
  • Re: Aristotle rejects natural selection, and dislikes its adherents
    ... You always refer to the massive number of neurons, ... You have nothing, and I have consistent ... Only when that data is put into context do we start getting ... many uses and explains how to effectively broadcast information. ...
    (talk.origins)
  • Re: Torkel Franzen on truth
    ... even in the context where it is insisted that N is a proper classm and ... just plain can't be a set? ... obviously consistent. ...
    (sci.logic)
  • Re: C is a Middle level language....
    ... demonstrated a consistent ability to impress the critics. ... Consistent makes no sense in this context. ... subthread is the phrase "can't consistently write correct code", ... those few extra words rules out the possibility the phrase refers to ...
    (comp.lang.c)