home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!caen!sol.ctr.columbia.edu!eff!ckd
- From: ckd@eff.org (Christopher Davis)
- Subject: Re: Using Gotos?
- In-Reply-To: dave@pipi.iis.u-tokyo.ac.jp's message of Tue, 25 Aug 1992 09:23:57 GMT
- Message-ID: <CKD.92Aug25172112@loiosh.eff.org>
- Sender: usenet@eff.org (NNTP News Poster)
- Nntp-Posting-Host: loiosh.eff.org
- Organization: Electronic Frontier Foundation Tech Central
- References: <DAVE.92Aug25182357@pipi.iis.u-tokyo.ac.jp>
- Distribution: comp
- Date: Tue, 25 Aug 1992 21:21:16 GMT
- Lines: 38
-
- David> == David Wuertele <dave@pipi.iis.u-tokyo.ac.jp>
-
- David> P.S. I have been equating "next LABEL;" with GOTO, perhaps
- David> mistakenly. Please flame if I'm being naive.
-
- At least one semi-religious article on structured programming that I've
- read said that transferring control to the end of a block is not, by
- definition, a GOTO of any sort (even if it's implemented with a GOTO),
- but merely an early escape from the block.
-
- next is definitely such, and (IMHO) increases clarity; try these:
-
- while (<>) {
- next if /^#/;
- &munge($_);
- &kludge($_);
- &many_lines_of_code;
- }
-
- while (<>) {
- if (!/^#/) {
- &munge($_);
- &kludge($_);
- &many_lines_of_code;
- }
- }
-
- In the second, it is not immediately clear that you intend to totally
- ignore the line; the many_lines_of_code might obscure an else or elsif
- clause, and you won't know 'till you scroll down. The two are logically
- equivalent, but differ in readability.
-
- I'm not gonna flame you; you certainly haven't done anything deserving
- of it... but you really shouldn't dismiss next/last/redo out of hand.
- --
- Christopher Davis * ckd@eff.org * System Administrator, EFF * +1 617 864 0665
- ``Ed Gruberman, you fail to grasp Ti Kwan Leep.
- Approach me that you might see.'' -- The Master
-