The way to avoid exceptions in ctors is using empty exceptions and issuing E_WARNINGs or E_ERRORs from every method when the instance wansn't initialized already. If you think twise this is worse and also comes along with a speed penalty from the additional checks. Anyway if you don't want to deal with exceptions in ctors then you probably might not want to deal with oo at all.


What marcus said. Also, I want the record to state that I'm not anti-exceptions. Neither, I guess is marcus. Both of us just prefer people use them appropriately, within well known mappings and usage cases for exceptions. Objects that have logic in a constructor throw exceptions - that's how it works. Same thing for overloads. These are not revolutionary concepts, but pretty standard OO paradigms.


In the same vein, many things that aren't exceptions are handled by E_WARNING and E_ERROR. If someone who understands exceptions wants to use them in an acceptable (and by this, I mean a manner that won't make someone with experience with OO paradigms go "what *is* he or she smoking?"), then they should be free to do so in standard PHP extensions (imho). But as for converting such things, please, let's leave well-enough alone.

-Sterling


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



Reply via email to