in reply to subroutine recurse vs goto LABEL

This is an argument that erupted in 1968 with Go To Considered Harmful and anyone in the last 20 years who has any awareness of program maintainability etc will tell you that the goto opponents won.

Do not use goto as a general purpose control device. Learn to think in terms of structured control statements like standard looping structures, function calls, etc. The remaining uses which are generally accepted for goto in languages like C are filled in Perl by loop control statements like next, last, and redo. The remaining uses of goto in Perl which I consider appropriate involve deep voodoo. That is essentially, "If you don't know, then don't ask. You won't need to be doing it."

  • Comment on Re (tilly) 1: subroutine recurse vs goto LABEL

Replies are listed 'Best First'.
Re: Re (tilly) 1: subroutine recurse vs goto LABEL
by John M. Dlugosz (Monsignor) on Sep 15, 2001 at 02:44 UTC
    So use a block and redo instead of goto for tail-end recursion elimination, if the compiler doesn't just do it for you. In this case, a "while there is still more to work on" loop is clearly correct.