Re: try..catch

From: Date: Wed, 30 Aug 2000 21:45:39 +0000
Subject: Re: try..catch
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-31339@lists.php.net to get a copy of this message
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@zend.com> http://www.zend.com/

« previous php.dev (#31339) next »