Date: Fri, 14 May 2010 20:14:27 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Alternative for "goto" in do loop
In-Reply-To: <201005141938.o4EAlFiL018283@malibu.cc.uga.edu>
Content-Type: text/plain; charset="iso-8859-1"
Paul my friend,
I dont think I am a purist, but rather just a hater of GOTO, Link, and starting to hate abort on certain OS's. I only say that because they end up leading more often than not to some pretty scary ugly code. Which ends up costing the company more so tha it can be redone correctly when it finally breaks and no one in the office can understand it much less fix it. Just seems easier to avoid using them rather than puting that first step on a slippery slope.
Toby Dunn
"Don't bail. The best gold is at the bottom of barrels of crap."
Randy Pausch
"Be prepared. Luck is where preparation meets opportunity."
Randy Pausch
> Date: Fri, 14 May 2010 15:38:37 -0400
> From: sashole@BELLSOUTH.NET
> Subject: Re: Alternative for "goto" in do loop
> To: SAS-L@LISTSERV.UGA.EDU
>
> Hey Toby,
>
> Does it make you a neat GOTO hater as well?
>
> Well, if you are a GOTO purist then you should completely eschew from your
> code
>
> DELETE
> CONTINUE
> RETURN
> ABORT
> LEAVE
> Subsetting IF
> LINK
> SELECT-WHEN
> IF-THEN-ELSE
>
> every one of which is nothing but the (at least one) GOTO pig with the
> correspondingly colored lipstick. All of them could be eliminated via a
> "properly constructed" DO UNTIL/WHILE code and flags set inside the loop
> body. But I do not think doing so would make code more readable, less
> convoluted, or more intuitive. In fact, I strongly suspect the opposite is
> true.
>
> If you use any of the above, methinks it is not the idea of the GOTO
> structure that you hate straight-up but rather the "GOTO" moniker which has
> become almost a derogatory word as a result of Dijkstra crusade against its
> *indiscriminate* use.
>
> To warn people against throwing away the baby with the bathwater, Knuth has
> even penned a paper "Structured Programming with Go To Statements"
>
> http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf
>
> published in his book "Literate Programming", but I guess it was too late:
> The myth about GOTO's extreme toxicity had already been ensconced in the
> impressionable minds of a generation of students during the time of their
> formation when cliches and bromides are most easily and reliably absorbed.
>
> The developers of Base SAS understood that leaving SAS programmers without
> properly used GOTOs would be a cruel and unusual punishment, hence the
> plethora of the GOTOs brethren properly disguised to help folks use GOTOs
> without calling them GOTOs, with the useful side effect of averting Toby's
> straight-up wrath.
>
> Kind regards
> ------------
> Paul Dorfman
> Jax, FL
> ------------
>
> On Fri, 14 May 2010 14:24:27 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:
>
> >Ahhh well we will have to agree to disagree on this. I am a stright up
> GOTO hater. Can't help myself I guess, I beleive that if you have to write
> a GOTO statement (other than in extreme rare circumstances), you need to go
> back and redesign your code. There is almost always a better approach than
> to use a GOTO. Thats just my opinion on the subject so take it for what
> ever it is worth.
> >
> >
> >
> >Reminds me of Macro Arrays. Yeah we should teach people about them, so
> that when they come across them they can rewrite the suckers in to either
> Macro list processing or one of couple oter methods that are easier and more
> efficient.
> >
> >Toby Dunn
> >
> >"Don't bail. The best gold is at the bottom of barrels of crap."
> >Randy Pausch
> >
> >"Be prepared. Luck is where preparation meets opportunity."
> >Randy Pausch
> >
> >
> >
> >
> >> Date: Fri, 14 May 2010 00:59:24 -0400
> >> From: s.lassen@POST.TELE.DK
> >> Subject: Re: Alternative for "goto" in do loop
> >> To: SAS-L@LISTSERV.UGA.EDU
> >>
> >> Toby,
> >> In terms of pure efficiency, gotos are sometimes needed, as long as SAS
> >> does not have a statement to leave an outer loop. (could possibly be
> >> implemented as "leave <n>" where n is the number of levels you want to
> >> escape, 1 being the default).
> >>
> >> Even when efficiency is not paramount, I think gotos sometimes
> >> make programs easier to write, read and maintain.
> >>
> >> Regards,
> >> Søren
> >> On Thu, 13 May 2010 16:11:10 +0000, toby dunn <tobydunn@HOTMAIL.COM>
> wrote:
> >>
> >> >Søren,
> >> >
> >> >
> >> >
> >> >Yes in general GOTO's are never needed. Proper loop construction,
> haveing
> >> no more than 3 levels of nesting, using proper branching, and in SAS
> coding
> >> the proper exit condtion at the beggining of the loop. SAS does have
> Leave
> >> and Continue statements. These aren't bad so long as the level of nesting
> >> and Looping is relatively simple. Th more omplex the Do-Loop the less one
> >> wants to use these as they just add unneeded code complexity.
> >> >
> >> >Toby Dunn
> >> >
> >> >"Don't bail. The best gold is at the bottom of barrels of crap."
> >> >Randy Pausch
> >> >
> >> >"Be prepared. Luck is where preparation meets opportunity."
> >> >Randy Pausch
> >> >
> >> >
> >> >
> >> >
> >> >> Date: Thu, 13 May 2010 12:05:57 -0400
> >> >> From: s.lassen@POST.TELE.DK
> >> >> Subject: Re: Alternative for "goto" in do loop
> >> >> To: SAS-L@LISTSERV.UGA.EDU
> >> >>
> >> >> Perusing Knuths execellent paper
> >> >> http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf
> >> >> (Thank you, Michael!), I stumbled upon this little gem:
> >> >>
> >> >> "Of course, event indicators are not the only decent alternatives to
> go
> >> to
> >> >> statements that have been proposed. Many authors have suggested
> language
> >> >> features which provide roughly equivalent facilities, but which are
> >> >> expressed in terms of exit, jumpout, break, or leave statements.
> Kosaraju
> >> >> [57] has proved that such statements are sufficient to express all
> >> programs
> >> >> without go to's and without any extra computation, but only if an exit
> >> from
> >> >> arbitrarily many levels of control is permitted."
> >> >>
> >> >> Which seems to vindicate my personal GOTO policy quite adequately,
> namely
> >> >> that GOTOs can be used instead of LEAVE when you need to break out of
> >> several
> >> >> levels of nested loops, and (in SAS) STOP or DELETE(/RETURN) is too
> >> drastic.
> >> >>
> >> >> Thanks to you all for an entertaining and enlightening discussion!
> >> >> Søren
> >> >
> >> >_________________________________________________________________
> >> >Hotmail is redefining busy with tools for the New Busy. Get more from
> your
> >> inbox.
> >> >http://www.windowslive.com/campaign/thenewbusy?
> >> ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
> >
> >_________________________________________________________________
> >Hotmail is redefining busy with tools for the New Busy. Get more from your
> inbox.
> >http://www.windowslive.com/campaign/thenewbusy?
> ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4 |