Zeev Suraski wrote:
> I believe we mentioned once the possibility of adding another error
> level, which is fatal - but still catchable by set_error_handler().

What actually would be the same as having a try block around your
application.

Right, which is infinitely better. It does not encourage (<-- not force) you to write code that recovers from exceptions, but rather - a trap-all just-in-case-something-goes-really-wrong error message.

Catch-alls are bad but... There is an even worse case: People start abusing exceptions for flow control/ normal operation like replacing something like "if ($obj) foo($obj)" with "try { foo($obj); } catch (Exception $e) {}" because the error message mentions exceptions and/or because they just learned about it and think it's cool.

If you guys decide to go forward and use an exception for type hinting (which is a tad more powerful, agreed) then at least make the exception message very clear that the caller of the function should make sure he passes the proper object type to the function, NOT that if should be wrapped in try/catch.

My $.02,
- Chris

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

Reply via email to