Code Comments
Programming Forum and web based access to our favorite programming groups."Michael Carman" <mjcarman@mchsi.com> wrote in message news:clousn$9421@onews.rockwellcollins.com... > Laura wrote: > > There *are* occasions when goto is necessary, just like there are > occasions when using symbolic references is necessary. Both situations > are very rare, but it does happen. > > That said, Perl has three flavors of goto, which are not all the same: > > goto LABEL > goto EXPR > goto &NAME > > The first two are the traditional "jump to someplace else" that's > generally considered bad. goto &NAME is very different: it replaces the > current subroutine with the one referenced. While the first two forms > are shunned, the third is quite common (e.g. in an AUTOLOAD). I notice that File::Compare and File::Copy both make extensive use of goto LABEL. Anyone care to comment on whether it's really needed in these modules?
Post Follow-up to this messageTintin <tintin@invalid.invalid> wrote in comp.lang.perl.misc:
>
> "Michael Carman" <mjcarman@mchsi.com> wrote in message
> news:clousn$9421@onews.rockwellcollins.com...
>
> I notice that File::Compare and File::Copy both make extensive use of goto
> LABEL.
>
> Anyone care to comment on whether it's really needed in these modules?
The question is not if it's needed, but if it is used reasonably.
Goto is evil when used as the primary means of flow control. At the
time Dijkstra mounted his campaign against "goto", there were
languages (most notably Fortran), that *had* no other large-scale
flow control ("if" only worked on one statement). That used to make
a mess of programs. The campaign wasn't so much against the use of
"goto" by individual programmers (they often had no choice), but
to foster the design of "structured" languages that didn't force
"goto" upon their users.
These days there are no more mainstream languages that aren't
"structured", so nobody talks about "structured programming" anymore,
but everyone does it. In that framework, the occasional "goto" is
no big deal, and it can be the operation of choice.
Anno
Post Follow-up to this messageTintin (tintin@invalid.invalid) wrote on MMMMLXXVI September MCMXCIII in <URL:news:2ubo3fF27cah6U1@uni-berlin.de>: ^^ ^^ I notice that File::Compare and File::Copy both make extensive use of go to ^^ LABEL. ^^ ^^ Anyone care to comment on whether it's really needed in these modules? It's not really needed. But I don't understand the question. I've noticed that File::Copy makes extensive use of 'while' and lexical variables. Anyone care to comment on whether it's really needed in these modules? Almost any construct is not "really needed", because there's always another way to do the same thing. Abigail -- :;$:=~s: -:;another Perl Hacker :;chop $:;$:=~y:;::d;print+Just.$:
Post Follow-up to this messageAnno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMLXXVI
September MCMXCIII in <URL:news:clqm9i$m3q$1@mamenchi.zrz.TU-Berlin.DE>:
//
// The question is not if it's needed, but if it is used reasonably.
//
// Goto is evil when used as the primary means of flow control. At the
// time Dijkstra mounted his campaign against "goto", there were
// languages (most notably Fortran), that *had* no other large-scale
// flow control ("if" only worked on one statement). That used to make
// a mess of programs. The campaign wasn't so much against the use of
// "goto" by individual programmers (they often had no choice), but
// to foster the design of "structured" languages that didn't force
// "goto" upon their users.
//
// These days there are no more mainstream languages that aren't
// "structured", so nobody talks about "structured programming" anymore,
// but everyone does it. In that framework, the occasional "goto" is
// no big deal, and it can be the operation of choice.
Let me also point to Donald Knuths "Structured Programming with goto
Statements", where he shows that using goto and structured programming
aren't multiple exclusive.
Abigail
--
A perl rose: perl -e '@}-`-,-`-%-'
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.