This "break LABEL" construct does exactly the same as "break NUM",

May be I missed something? I didn't look into patch deep.

Your take is spot-on. This isn't an extension of functionality, just a "numbered breaks with a name" which is something I've heard requested from several corners (including @zend.com) as a "wouldn't it be nice..."

Also I don't like syntax for loops that you suggested.
I prefer "LABEL: while(1) {...}" instead of while LABEL (1) {...}".

I agree that the positioning of the label has an inherent ugliness to it. I avoided "LABEL: while (1) { }" however, in order to avoid conflicting with and complicating the GOTO discussion. Since (if goto was added as well) this syntax could create an ambiguity in what the label means.

Since you'd like the label to be moved out of zend_brk_cont_element, then perhaps we can allow this syntax to pull double duty...
LABEL: whlie(1) {
 break LABEL; <-- el->brk
 continue LABEL;  <-- el->cont
 goto LABEL;  <-- opline->u.opline_num
 break OTHERLABEL; <-- error
 continue OTHERLABEL; <-- error
 goto OTHERLABEL; <-- opline->u.opline_num
}
OTHERLABEL:
nonBreakContainerStatement();

This construct has logic and make sense, but I am not sure that we should
incrise complication of PHP compiler without any serious benefits.
Readability is the only one benefit of this patch.

So the question is:  How serious is the gain in readability/maintainability?

-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to