Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
As others have said it is not about politics but about safety. And after enough experience a programmer learns that they are their own worst enemy, so anything you can do to lessen the incidence of problems is a bonus.
The main problem with goto is not understanding potential side-effects. If you goto a particular location then you run the risk of using code that assumes a different state to the one you arrive in. My issue with goto has always been the stack - I will (albeit rarely) use goto if it does not involving changing contexts (i.e. never jumping into or out of a set of curly braces). But I really don't know the implications to memory usage and contexts when I do something like the following (in C or in Perl):
Now my question is what happened to $j there? Is the compiler "smart enough" to know that I exited the loop and therefore the memory allocated to $j can now be reclaimed? Even worse, what happens when I use goto to jump between subroutines? It is because I don't know the answers to these questions that I do my best to avoid the use of goto (except when necessary and not involving context changes). In reply to Re: GOTO or not GOTO
by monarch
|
|