I'd say:

foreach ($arr as $val) as foo
{
  if (true)
    break foo;
}

I don't like the idea at all that labeled breaks are in any way connected to 
'goto' usage. It's my opinion that the two can coexist without a problem, 
and that's how I would prefer to see it being used.

Besides, BAR:while () { } would not do well with a future 
goto-implementation, because that would mean it would jump to the beginning 
of the loop, and not out of the loop. Maybe you mean to say that labels for 
goto and break can exist in the same collection, but I wouldn't be a fan of 
that at all.

Semantically, 'goto' behavior is very different from break-behavior. With a 
break I expect to leave a certain construct that has a certain name, with 
goto I expect to jump to the line of code that was labeled with a name. I 
think the usage is different enough not to want those labels to be the same 
kind of things. Maybe other people disagree, but my point is that the 
difference in semantics is really something to consider.

When you make break-labels the same as goto-labels, I would find this a bit 
weird to read:

FOO: while (true)
{
  ...
}

Will it be used for breaking out of the loop or for jumping to the loop? 
Should I expect a goto statement somewhere in this file?

- Ron



"Bart de Boer" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
> Sara++  :)
>
> Although I prefer BAR:while (This would go better with goto if someone 
> would want to implement that some day.) I'd settle for while BAR since I 
> don't care about goto anyway.
>
> So:
>
> foreach BAZ ($arr as $val) +1
>
>
> BAZ: foreach ($arr as $val) +2
>
>
> foreach as BAZ ($arr as $val) -2 ('as' can be a bit confusing here) 

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

Reply via email to