Re: Re: Labeled Breaks (not the G-word)
| From: | Stanislav Malyshev | Date: | Tue, 29 Nov 2005 12:07:41 +0000 |
| Subject: | Re: Re: Labeled Breaks (not the G-word) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20816@lists.php.net to get a copy of this message | ||
EK>>This might be from implementation/engine point of view, but from user's
EK>>perspective goto is much more limited. It can only happen within one
EK>>function.
That's good. PHP is a limited language - you can not do many things in PHP
that you can do in C, for example. Many of these things usually are called
"bugs" when people do them :)
EK>>Exception on the other hand might take code execution into totally
EK>>different file which is why I guess it feels much less restricted that goto.
Exceptions never should be used "to take execution into different file".
That's not their purpose and if you plan to use them with this intention
- don't. Exceptions are meant for the thrower - to signal that situation
does not allow for the current function to continue execution and for the
catcher - to deal with the exceptional situation respectively. It's
purpose is to handle exceptional situation, not to pass control around -
which is exactly the purpose of goto. And the reason why I don't like it.
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115