Re: New style DO syntax?



Gordon Sande wrote:
....
General form of

FOR initialize THEN successor WHILE ( temination )

with a toy nonsense illustration

FOR i = 1 THEN i = i + 1 WHILE ( whatever )

I've never liked putting the last thing a loop does at the
beginning of the loop. This "successor" code isn't invoked
at the beginning of the loop so it shouldn't be there. Even
within the statement, the WHILE condition is tested before
the successor code is invoked, why does it follow?

Are you suggesting allowing a whole block of code as the
"initialize" and "successor" parts? If not, what happens
when the loop requires more initialization or successoring (?)
than one statement can handle? If you are expecting to allow
multiple statements, won't the programmer be tempted to
put the whole loop in the "successor" part (as is common
in the similar C construct)? In that case, what's the difference
between what you have and the following?

initialize
Do while(termination)
successor
End do

When designing a new feature, all plausible uses should
be considered rather than just the ones that match your
intent.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


.