Hi! > Personally, I'm used to what other languages like Python do, and I think > it makes more sense. Exceptions mean you can try/catch the things your > code needs to be prepared for (non-existence, maybe), but other things
No, they mean you need to *always* try/catch since you have to means to check if the downstream function can throw and exception or maybe call some other function that throws and exception. Exceptions propagate. In Java, you have compiler-controlled throws (which doesn't work in 100% of cases either - I regularly get exception messages from Eclipse, and this one is written by people with great knowledge of Java) - in PHP, you will have nothing. It's one thing when the code writes a warning and returns null when something unexpected happens, another when it throws and exception and you *have* to know which kind it will be and catch it - or just catch everything and ignore it (because you have no idea what it might be) and - check some success value then! > you haven't considered or are very unlikely, can just not be caught and > cause your code to halt execution. And it makes it harder to > accidentally avoid checking for errors and then wonder why $file is some > NULL or FALSE or other "error" value. How it makes it harder? If you forget to check the result, you'll as well forget to try/catch. It just makes the consequences worse - and remember, this all happens in runtime! -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php