Re: Labeled Break (nothing at all whatsoever to do withGOTO)

From: Date: Thu, 01 Dec 2005 18:28:41 +0000
Subject: Re: Labeled Break (nothing at all whatsoever to do withGOTO)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-20971@lists.php.net to get a copy of this message
> I made another patch that is based on your ideas. > > 1) It uses "right" syntax: > > LABEL: while(1) { > break LABEL; > } > > 2) It doesn't allow usage of same label for different loops > > L1: while(1) {...} > L1: while(1) {...} > > 3) It doesn't use executor data structures > > 4) It allows reuse of same labels for jump/goto (as was done in your > first patch). It already declares "jump LABEL;" operator but emits > error for now. > > I think this patch can be committed and then we can discuss > jump/goto. > I agree. This gives us a clear, unambiguous syntax, puts no additional load (either memory or cpu) on the executor and sets the groundwork for jump/goto *if* it's deemed worthy of PHP. To just just offer out piccune little points (not trying to kvetch or anything): * Declarations of zend_label *label; and long distance = 1; in zend_do_brk_cont() have a mix of spaces and tabs in their indentation rather than exclusively tabs. * zend_error(E_COMPILE_ERROR, "%s to to label '%R', also in zend_do_brk_cont() has a superfluous 'to'. Thanks Dimitry! Andi/Zeev- Can one/both of you weigh in on this at this point? -Sara

« previous php.internals (#20971) next »