Re: Re: if elseif elseif elseif....
| From: | Paul M Foster | Date: | Sat, 07 Mar 2009 16:39:44 +0000 |
| Subject: | Re: Re: if elseif elseif elseif.... | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289552@lists.php.net to get a copy of this message | ||
On Sat, Mar 07, 2009 at 05:52:55AM -0500, Robert Cummings wrote:
> 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, danbrown@php.net (Daniel Brown) wrote:
> > >
> > > >On Fri, Mar 6, 2009 at 00:12, Clancy <clancy_1@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.
My deities (Kernighan and Ritchie) told me not to use it, and I don't
want to offend them. They also told me how to indent my code. ;-}
Once we have goto, it's a short slide down a slippery slope to setjmp
and longjmp. And thence, the apocalypse. ;-}
Paul
--
Paul M. Foster