Re: exceptions

From: Date: Wed, 09 Jun 2004 10:30:34 +0000
Subject: Re: exceptions
References: 1 2 3 4 5 6  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30260@lists.php.net to get a copy of this message
Hi! Lukas Smith wrote:
Yes, it does force users to do error handling. There's nothing to argue there; I think that's wonderful. (finally!) The current model makes it all too easy to lose errors if you forget to check a return value. And makes it impossible to establish code "transactions" that should fail on error.
Sometimes you have to stop and think why you are using PHP to begin with. I use it because simple things can be done rather simple and increasingly complex things are also possible with reasonable effort. You are argueing that everything should become complex. That is not why I choose PHP and I doubts its why PHP has become successful. PEAR does aim to provide solutions to a wide audience, including beginners. We define how we want to code, but we have no mission to define how other people have to code. This is not in the spirit of a library. That is not to say that we should try to set good standards that other people may choose to adopt.
Some obvious things to consider: 1) Most of these "beginners" do have some JavaScript background. And JavaScript obviously has exceptions. 2) I routinely answer questions on pear-general that could've been solved without any posting if the person asking ever bothered to check the return value of the method. If the method in question raised an exception instead of returning a toothless PEAR_Error, he would be *forced* to handle that and I'd have a message less to answer. Seems like a win-win to me. In other words: if a person, let's name him Lukas Smith for the sake of example, has idiosyncrasy to exceptions, he may refrain from using them in his packages. But if that person wants to force his idiosyncrasy onto the whole PEAR, he would have to find *extremely* good arguments.

« previous php.pear.dev (#30260) next »