[Gambas-user] static const?

Fabián Flores Vadell fabianfloresvadell at ...626...
Tue Apr 13 23:24:46 CEST 2010


> Why shouldn't the compiler allow to modify a loop variable? It is sometimes
> useful.

I'm refering to the loop FOR only. IMHO, WHILE and REPEAT are good
structures that allow at programmer take absolute control over
iterations, objective of FOR is iterate all items of a memory
structure. At least, I think that was of the original design purpose
(distorted after).

In fact, the need of FOR structure is relative. Any need can be easily
cover with WHILE and REPEAT.

I don't see the need for break a iteration structure from inside, in
any way (even break and continue). This would be done from conditional
input or output of the structure. But I see the consecuences.

May be, the exeption to this is FOR EACH structure.

> Why shouldn't the compiler allow to return from inside a loop? It is perfectly
> valid to do that.

Why allow break a loop in this way? That often leads to write multiple
statements  RETURN in a function. That does not comply with the
theorem of structured programming (that have as one of its premises
allow only a input point and unique exit). I think that in practice
this difficults the tests; if necesary to port the code, this could be
an aditional problem; among other things.

> A bad programmer using some syntax for writing bad code does not necessary
> imply that that syntax should be forbidden.

I agree, but actually I was thinking that this affect more to those
who approach programming in an informal way.


-- 
Fabián Flores Vadell
www.speedbooksargentina.blogspot.com




More information about the User mailing list