On Sat, 2009-03-07 at 02:12 -0500, Paul M Foster wrote:
> On Sat, Mar 07, 2009 at 11:29:41AM +1100, Clancy wrote:
> 
> > On Fri, 6 Mar 2009 08:53:44 -0500, danbr...@php.net (Daniel Brown) wrote:
> > 
> > >On Fri, Mar 6, 2009 at 00:12, Clancy <clanc...@cybec.com.au> wrote:
> 
> <snip>
> 
> > >
> > >    Then you'll be happy with the advent of PHP6:
> > >
> > >        http://php.net/goto
> > 
> 
> Someone would add gotos to a language *on purpose*?!

The demonization of goto was due to the kind of goto found in older
languages that would either a) goto an arbitrary line number where line
numbers might change as new line numbers were needed (who invented that
concept anyways???). The other was where you might jump willie nillie to
a globally defined goto label that might appear anywhere in a program
versus jumping to a goto label within a well defined context. The goto
added to PHP allows jumping only within the current context... you can't
jump out of a function or into a function, nor as the help says can you
jump into a loop, or into a switch statement. What this does is greatly
simplify some types of coding where you might otherwise have to use
multi level breaks, or define a temporary variable whose value is
checked at various breakpoints. Goto resolves these issues by allowing
jumping directly to a defined label within the context. Additionally,
implementation of things likes parsers are extremely succinct using goto
semantics. Goto has a place in languages, just not ad-hoc poorly thought
out goto.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to