Hi Uri and Peter,

On Thursday 14 Apr 2011 09:15:35 Uri Guttman wrote:
> >>>>> "PS" == Peter Scott <pe...@psdt.com> writes:
>   PS> On Wed, 13 Apr 2011 21:57:53 -0700, Mariano Loza Coll wrote:
>   >> Like Owen, I've come across many a recommendation AGAINST using goto
>   >> in Perl. And (like Owen?), I have yet to find one that explains
>   >> clearly the reasons arguing against its use. If nothing else, it has
>   >> made me very curious... Can any of the more experienced programmers
>   >> (ie. nearly everyone else on this list by my standards) point to a
>   >> good explanation as to why one should avoid goto in Perl (or coding
>   >> in general)? I looked around in perl-begin.org but couldn't find
>   >> anything obvious. Once again, I make my request from the purest
>   >> desire of learning Perl the best way I can.
> 
>   PS> Here is the definitive explanation:
> http://www.cs.utexas.edu/users/EWD/ PS> ewd02xx/EWD215.PDF .
> 
> having heard about that article for many years it was interesting to
> read it. it may be over the head of some members here but useful to read
> anyway. it doesn't go into any practical reasons why goto is bad. it
> just says the logical complexity (his index data) goes way up with gotos
> but stays reasonable with high level flow controls
> (if/else/while/sub/etc.).
> 

Regarding the "Goto statement considered harmful" myth, see what I wrote about 
it here:

http://discuss.fogcreek.com/joelonsoftware3/default.asp?cmd=show&ixPost=78092

Quoting my post:

[QUOTE]

The entire "GOTO statement considered harmful" is quite a myth. Granted, 
Dijkstra wrote an article with this title, and many people agreed with him. 
But, on the other hand, some people have demonstrated that it is possible to 
do structured programming with goto statements, and sometimes even better with 
them than without them.

For example, Don Knuth wrote an article "Structured Programming Using Goto 
Statements" (rumouredly sub-titled "'Goto Statement Considered Harmful' 
Considered Harmful") in which he deomnstrated exactly that. And I take this 
view as well.

Don't get me wrong, I don't advocate a goto-spaghetti, like I once saw in old 
BASIC programs. But goto's have their use.

When programming in C, I find myself using goto's whenever I feel the need to. 
This occurs less in Perl where I have other powerful constructs.

[/QUOTE]

There are other useful comments there.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

http://en.wikipedia.org/wiki/Evil redirects to XSLT.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to