Re: "GOTO considered harmful" considered harmful. Re: New style DO syntax?



James Giles wrote:
Kevin G. Rhoads wrote:

The parenthetic DO could include an end label something like this:

DO (I=1,10,END=100)
N(I)=1
100 CONTINUE

However, I would expect that all other block constructs should then
have the same option for using an end label.

Fine, but then generalize the labels to be alphanumerics, perhaps
terminated by a single colon. MHOO: The main problem with goto
targets in Fortran is not the GOTO, it is the numeric labels. "GOTO
considered harmful" considered harmful.


I disagree. One of the only good things about older conventional
Fortran was the numeric labels. If more constructs besides
GOTO and DO used them it would have been an improvement.
With numeric labels you can keep them in order and that helps
navagate the code. Alphabetic labels could be ordered too, but
people tend to try to find names instead. Hence they are no
particular use in finding your way around the code.


One could equally argue that procedures should all be referred to by number and sorted, for the purpose of navigating the source file. If you really want numeric labels to navigate code, why not number all lines?

The advantage of a text label is that you can tell the purpose of the GOTO without having to navigate to the target label to discover what the the purpose of that GOTO.

However, the above suggestion was for general alphanumeric labels, which would allow either numbers or text. You could even combine them to appeal to both ways of thinking: GOTO 220_singular_matrix

Joe
.