At 01:15 PM 4/15/2004 +0200, Christian Schneider wrote:
Andi Gutmans wrote:
I don't think allowing the return of anything except for the object itself is *fixing* PHP.

No, being able to fail and return would not be fixing it. It would be extending it to allow people to avoid exceptions for this simple case.


For example, in the SOAP extension it is very useful that in the SoapServer you can throw an exception and that'll create a SOAP error. Any other value you return will be the SOAP result. This is a perfect place for exceptions.

I tempted to challenge you to give me an example usage which I could rewrite without exceptions, making it simpler and/or fixing problems ;-)

If you are inside a SOAP handler, nested inside a few functions and decide you want to fail, you can throw an exception instead of having to return an error all the way up the stack.


Guys, I'm am not for forcing people to use exceptions. I agree that we should make PHP another Java exceptions from hell (especially with their exception declarations in function prototypes which is horrible). I'm just saying, that some extensions might benefit from exceptions and the extension author should be allowed to choose (as long as he doesn't break BC).

Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to