On Feb 13, 2004, at 8:39 AM, Andi Gutmans wrote:
At 08:12 AM 2/13/2004 -0500, Sterling Hughes wrote:What is the reasoning for this new change?
The reasoning is that it allows users to do a catch-all (which otherwise we'd add to the language syntax). It also adds cleanliness to the Exception hierarchy and allows PHP code to interact with PHP code which isn't written by the developer knowing that there's a common interface (such as getMessage()) which the exception always adheres to. That improves the ability of exception handling especially debugging and logging significantly.
The above description sounds more like a 'best practice' and less like something that PHP should be forcing on users. If I explicitly choose to create an exception that must be caught specifically, I don't see why I shouldn't be allowed to do that.
Because, in any case, we would then add a construct to catch all exceptions but you'd loose out on the fact that you don't have an interface you can rely on.
At the end of the day, if you look at the two alternatives, I think this is the best one and leads to much better and robust code.
Andi
-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php