Re: OT: The REAL RIddle of DO LOOPS Solved
- From: "Reef Fish" <Large_Nassau_Grouper@xxxxxxxxx>
- Date: 26 May 2006 08:00:52 -0700
Richard Atkins wrote:
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.
I assume you mean "decrement" or "STEP -1".
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.
You haven't exhibited ANY ambiguity. STEP (Sgn) (B-A) would
have worked if that's an allowable explicit statement for STEP.
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.
In fact that is my contention that any BASIC should KNOW in the
statement FOR n = A to B
whether the STEP is +1 or -1, without requiring the explicit
statement of STEP or STEP SGN(B-A).
You should read the rest of the discussion in alt.lang.basic where
this thread has already doubled the total posts in that group prior
to yesterday (15), and the thread itself has run to 30, making the
current total of 45 posts for May.
-- Bob.
.
- Follow-Ups:
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Richard Atkins
- Re: OT: The REAL RIddle of DO LOOPS Solved
- References:
- OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Lou Thraki
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Richard Atkins
- OT: The REAL RIddle of DO LOOPS Solved
- Prev by Date: Importing Data to R
- Next by Date: Re: Hidden information question
- Previous by thread: Re: OT: The REAL RIddle of DO LOOPS Solved
- Next by thread: Re: OT: The REAL RIddle of DO LOOPS Solved
- Index(es):
Relevant Pages
|