> Eating humble pie now. I used to program in assembly and you guys are all so
> right, most of that code consists of "jmp"s.

Frank:

I'm sort of in the middle on this.  I agree with you about using structured
programming concepts.  I have never abandoned WHILE and RETURN in favor of GOTO
and QUIT TO because they make the code much less readable.  I also have never
experienced the memory problems other people report with these structures (or
rather, when I have a problem I can always trace it to something in my code, or
find another work around without giving up WHILE and RETURN).

On the other hand, every single R:Base routine that I write always contains
GOTOs.  I find they are necessary to work around R:Base's lack of variable
scope.  Every routine I write has a single RETURN statement at the end,
preceeded by LABEL CleanUp and the clean up code for the routine.  To exit the
routine from the middle, I use GOTO CleanUp instead of RETURN.  This way, I'm
always sure the clean up code is executed.  I believe this leads to a more,
rather than less, structured system:

$COMMAND
MyFunc
SET VAR vMyFunc_Var1 = Something
SET VAR vMyFunc_Var2 = SomethingElse

. . . Checking Code. . .
IF SomeCondition THEN
  -- Display problem message
  GOTO CleanUp
ENDIF

DIALOG 'Want to process now?'
IF vMyFunc_YesNo <> 'YES' THEN
  GOTO CleanUp
ENDIF

. . . Do Something Code . . .
. . . Check intermediate result . . .
IF SomeCondition THEN
  -- Display problem message
  GOTO CleanUp
ENDIF

. . . Finish processing

LABEL CleanUp
CLEAR VAR vMyFunc_%
DROP TempTable
DROP TempCursor
RETURN

--
Larry

Reply via email to