Hello Marcus,
Wednesday, August 6, 2003, 1:14:10 PM, you wrote:
CD>> What about finally ?
MB> There's absolute no need for finally:
MB> try {
MB> }
MB> catch (...) {
MB> }
MB> // here's you're finally code
try
{
$this->allocateSomeResources();
throw new SomeException();
}
catch( AnotherException $e )
{
}
finally
{
$this->freeSomeResource();
}
This code will call freeSomeResource() -- that's why one may want to
have finally.
But I agree that there's no need for finally. If uncaught exception
is thrown -- it's bad application design or
malicious component( you cannot declare throws in function definition
so some evil component can do something like
" throw new ExceptionThatNobodyHandles(); // har-har-har!" .
You need to refactor in first case and
can do nothing in second -- if you'll start to free resources in
finally after each try-catch or always catch Exception,
your code will become garbage soon IMHO.
--
Best regards,
Simeon mailto:[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php