Re: PEAR's Error Handling and PHP5
| From: | Justin Patrin | Date: | Wed, 07 Jun 2006 21:02:47 +0000 |
| Subject: | Re: PEAR's Error Handling and PHP5 | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-42842@lists.php.net to get a copy of this message | ||
On 6/7/06, Pierre <pierre.php@gmail.com> wrote:
On Wed, 7 Jun 2006 12:45:46 -0400 matthew@zend.com ("Matthew Weier O'Phinney") wrote:PEAR enforces many design choices (enforces, not recommends), some of which are: 1) class and file names 2) coding standards and styling 3) PEAR_Error(_Stack) usage for error handlingI'm defitivally and totally against forcing design choices. Exceptions usage is a design choice Understand you use them when you consider you have not because a rule foces you to use them everywhere as error handler or control flow.
Using PEAR_Error is a design choice, too, and PEAR enforced that until PHP5 came along. Wrong, we never force anyone to use PEAR_Error in a package. But to use PEAR_Error (or derived) if the package needs an error handler. That's not exactly the same thing.I think you're mistaken. PEAR enforces use of PEAR_Error to keep error handling consistent. I can't remember the number of times I have told new package maintainers to use PEAR_Error instead of other things. This is one of the tenets of the PEAR system, consistent error handling.
Can someone on-list provide some reasons *for* sticking with PEAR_Error? or some information on where exceptions *wouldn't* fit with PEAR? For one, did I ever say that exceptions do not fit in PEAR? or do fit? No. Because it is a design choice. Reasons other than "this forces design decisions" or "exceptions are evil"? I'd like to see some real, issues-oriented debate. That's simply not possible, unless you are ready to discuss hundred of cases one by one. We should simply allow both, even within one package. I'm sorry, but forcing design choices is my main argument here and that's why I was always against enforcing one or another (no matter the php version). There are plenty of good arguments now why exceptions might be the right direction; let's see if there are some good arguments for PEAR_Error in a PHP5 world. There is indeed a place for PEAR_Error (and derived) in php5, as well as there is a place for exceptions in pear. One does not make the other obsolete.I'm sorry, Pierre, but I think you've lost the point. The point of this thread is to standardize PEAR's error handling in PHP5. You have once again given no technical reasons for the use or non-use of Exceptions, just an opinion that they shouldn't be used. Please reply to my pros and cons, write up your own list, or give some other technical reasons why one or the other should be used. Or give some reasons why both should be allowed. This *is* one of the options I outlined in my original e-mail, I just don't believe that this is an option right now as Exceptions can do pretty much everything that PEAR_Error can do and do much of it better. If there is a fundamental difference that we are missing, please let it be known. -- Justin Patrin