Re: Labeled Break (nothing at all whatsoever to do withGOTO)
| From: | Sara Golemon | Date: | Thu, 01 Dec 2005 16:03:20 +0000 |
| Subject: | Re: Labeled Break (nothing at all whatsoever to do withGOTO) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20956@lists.php.net to get a copy of this message | ||
We're definately on the same page as far as implementation goals, but I can't help but notice one problem:
* labels aren't scoped to functions. The break container checks prevent casual jumping, but:
FOO: do { } while (0);
function bar() {
do { break FOO; } while (0);
}
Actually compiles legally. Of course the actual break stays within its local container, but if/when Jump is introduced to the mix....well... all bets are off...
-Sara
----- Original Message ----- From: "Dmitry Stogov" <dmitry@zend.com>
To: "'Sara Golemon'" <pollita@php.net>; <internals@lists.php.net>
Cc: "Zeev Suraski" <zeev@zend.com>; "Stanislav Malyshev" <stas@zend.com>
Sent: Thursday, December 01, 2005 2:45 AM
Subject: RE: [PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)
Hi Sara, 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. Thanks. Dmitry.