GOTO replacement statements
| From: | Tim Gales | Date: | Wed, 30 Nov 2005 17:23:20 +0000 |
| Subject: | GOTO replacement statements | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-20903@lists.php.net to get a copy of this message | ||
I was wondering if it would be worthwhile to consider
replacing the functionality of a 'goto' statement with
two or maybe three statements.
'break_to' 'advance_to' and maybe even 'change_state_to'
while($foo1) as LABEL1 {
....
while($foo2) {
...
if($var1)
break;
if($var2)
break_to LABEL1;
...
if($var3)
advance_to LABEL2;
...
..
}
LABEL2:
'break_to' might make it easier for someone who
has to review/maintain the code to spot it as
a 'goto' replacement to break out of a nested loop.
'advance_to' would hopefully cut down on the number
of bug reports claiming that 'jump' doesn't work
properly (when trying to go backwards)
Regards,
Tim Gales