Re: Mail_IMAP 2.0.0 alpha 1
| From: | Hans_L | Date: | Tue, 06 Jul 2004 21:02:53 +0000 |
| Subject: | Re: Mail_IMAP 2.0.0 alpha 1 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-31672@lists.php.net to get a copy of this message | ||
Justin Patrin wrote:
Justin, I'm not sure what to say. In my applications errors are exceptional, by definition ;) I can only assume that you have never used exceptions. Well, regardless of how you formed that opinion it certainly is your opinion, but in *my* opinion it runs contrary the reason why Exception was added to the language -- certainly contrary to the way exceptions work in any other language I know. A good reference (i.e. good = that I agree with ;) for how Exceptions work and how to use them in PHP5 is George's book: Advanced PHP Programming. It's an excellent book all around, really. HansIMHO, they're not for general error handling, but for exceptional circumstances, which mostly halt a program. If you want to be able to handle errors, a return value is much more convenient and makes more sense than a try/catch block. It makes it obvious which call had the error and makes it obvious what code is run and what is not. Exceptions are, in my eyes, nearly as bad as gotos. It makes code harder to read and trace and can quite easily cause problems.Yes, it does seem we are alone. I have seen maybe 2 messages in support of Errors. Everyone else says to use Exceptions for everything....even though Exceptions are *not meant for error handling*!What? Says who? ... that's exactly what they're designed for.