Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:5313 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17013 invoked by uid 1010); 7 Nov 2003 15:15:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 16986 invoked by uid 1007); 7 Nov 2003 15:15:06 -0000 Message-ID: <20031107151506.16985.qmail@pb1.pair.com> To: internals@lists.php.net References: <20031024200902.90818.qmail@pb1.pair.com> <5.1.0.14.2.20031031010103.03db8bd0@127.0.0.1> Date: Fri, 7 Nov 2003 13:15:06 -0200 Lines: 33 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Posted-By: 200.196.104.198 Subject: Re: [PHP-DEV] Re: finally again From: cunha17@uol.com.br ("Cristiano Duarte") Hi Andi, > I've stated my opinion in the past (search the archives) and I don't = think=20 > it'd be feasible (nor critical) to implement this... Do you agree that if we don't have finally we should have a way to catch = all exceptions ? Let me explain: If you have a library that can raise a huge number of different = exceptions and you don't have finally, you should treat all exceptions = at the same try/catch block, and rethrow the exceptions that should = propagate. If you have finally, you can treat just the exceptions you need and = leave the others to be treated by the caller. For example: if you don't have finally, don't have a "catch-all" clause = and lock some resouce inside a try block, you need to unlock it: 1) in the try block: before every return statement after the = resource allocation 2) write a catch block for all possible exceptions that could be = raised and put the code before every return/throw statement (this could = be dozens of times) 3) at the end of the try/catch block If you have finally, you just put the same code inside the finally = block. No need to catch every exceptions one-by-one, no need to rethrow = exceptions that shouldn't be caught, no need to make code redundancy... I know it's not critical, but IMHO it's important. I hope I was clear = enough... :-) Cristiano Duarte