Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
OK, awreddy! The wisdom elsewhere in this thread prompts me to expand what appears to be my minority response to the OP: First, for clarity, allow me to amend "For the purpose ... ahead and GOTO." to read: "For the NARROW purpose you've outlined, perlitical correctness is not the issue. "Perlitically correct" be damned! If it works, go ahead and GOTO (sic) (but don't get in the habit)! Yes, even that runs counter to convention wisdom (and I readily acknowledge that the conventional wisdom is wise. (In fact, the bit of nonsense below represents the first time I've even considered using goto in years.) But I read the OP, the Seeker has a suite of tests of "human reaction," each of whose members stands alone. IOW, I conceive each test to be fundamentally self-contained and (perhaps) presented in a fixed sequence; that his offer to re-run the tests would occur only upon completion of the suite. In such a case, concerns about spaghetti code, readability, resetting of variables, and all the other usual problems with goto are (or can be, in a(n otherwise, if you must) well-written program can be moot. The script below, while not reflecting precisely the constraints above, may invite comments... or even second thoughts???
For "nonsense" constructed specifically to use a goto, this seems to me (YMMV) clear and utterly without 'strange actions at a distance.' FTR, in NO way does it rebut the correctness of deprecating goto; rather, it's intended as a reminder that there are -- occasionally -- times to violate conventional wisdom and ways to sidestep the underlying evil that norm seeks to avoid. In reply to Re: GOTO or not GOTO
by ww
|
|