Re: [PHP-DEV] try..catch From: Andi Gutmans (andi <email protected>)
Date: 08/31/00

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:
>>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 <email protected>>
>http://www.zend.com/
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>