RE: [PHP-DEV] Re: Labeled Breaks (not the G-word)
| From: | Derick Rethans | Date: | Thu, 24 Nov 2005 10:04:14 +0000 |
| Subject: | RE: [PHP-DEV] Re: Labeled Breaks (not the G-word) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20289@lists.php.net to get a copy of this message | ||
On Thu, 24 Nov 2005, Dmitry Stogov wrote:
> 1) The new syntax makes mess for me.
> "break" is a statement that exits from loop or switch, now we make a "goto"
> statement but name it "break".
> I belive that if we really implement goto (even with some limitations) we
> shuld name it "goto", but not "break".
> (changed in attached patch).
>
> 2) After (1) I don't see any reason in limitation to jump only down, if we
> can jump up as well. (the limitation is removed in attached patch).
We discussed both those points in the meeting, and afaik agreed on the
current behavior for several reasons:
- "goto" has a bad feeling:
"The name "goto" is misleading, and often associated with BAD
THINGS(tm). Because our proposed solution is not a real GOTO
construct, we will instead reuse the "break" keyword, and extend
it with a static label."
- we wanted to prevent spagetti code which you can do by jumping up:
"Similarly restricting the construct so that you can only jump
down should satisfy people who do not want the ability to jump all over
the place."
regards,
Derick