Re: try..catch
| From: | Andi Gutmans | Date: | Thu, 31 Aug 2000 04:44:08 +0000 |
| Subject: | Re: try..catch | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31375@lists.php.net to get a copy of this message | ||
I agree that exceptions need to have their own scope. The last thing try {} catch should encourage, and you can read this in any OOP book if it's C++ or Java, is to start implementing logic with/inside it instead of just error recovery.
In the case of PHP, it will probably just want to print a nice error messsage, maybe log the error message and terminate.
Andi
At 12:45 AM 8/31/00 +0300, Zeev Suraski wrote:
At 00:41 31/08/2000, Mathieu Kooiman (ggInternet) wrote:--- Andi Gutmans <andi@zend.com> http://www.zend.com/Will the catch block have its own scope? I think this'll be a (nasty) side effect cause an own scope would cause ppl to start writing "logic" into catch blocks on the other side.. try implementing it without its own scope.. (anonymous function, thus its own hashtable?)As far as I know, catch blocks always have their own scope (basically they're no different than any other block). I don't think it's an issue, since there are other reasons on why it'd be difficult/very inefficient to use exceptions to implement logic. What are the alternatives? As it has to have SOME sort of a scope, it's either its own, or the scope where the exception occurred. In my opinion, it'd be much worse if it'd be the scope of the exception, because then people would start writing code to check the status of various variables, and behave accordingly. Isolated error recovery code makes much more sense in my opinion. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net