Hello Stephane,

Saturday, January 24, 2004, 4:20:33 PM, you wrote:

> == Quote from Timm Friebe ([EMAIL PROTECTED])'s article
>> It's basically the same with the built-in exception class. I can't have
>> my own (at least not with the sexy-most name "Exception"). Then, in my
>> (very personal) view I want it designed differently, and want to have it
>> extend _my_ base class (which, incidentally, is called "Object" and does
>> _not_ have constructor:)) - again, this is _my_ very personal feeling
>> about how it should be - so I'll just have my own exception, which is
>> perfectly OK and dealt with very well by the Zend Engine.

> Exception is a very good example why I think sharing a common base
> class is necessary (I also posted a message on that). Imagine I use my own
> exception base class, and you use your own.

Well you should always by no exception derive your exception classes from
the builtin exception class. Just because that class can do things you can
never imlement in your scripts. And it allows some special handling because
the engine knows all its internals. And yes this is very much different from
normal class and stdClass.

> Now what will happen if I get some code from you? I will have to review
> all my code and verify everywhere I want to catch all the exceptions (kind
> of "finally" clause), if one of your exception classes could be thrown and
> then add your base class in the catch list. Not so easy and prone to bugs.
> To avoid that, either PHP should implement a generic catch (like C++
> "catch(...)" or "finally") or we have to share the same base class, which
> could be empty or be an interface.

> Many OO languages impose base classes and, for sure, they can not
> implement all everybody needs, and may sometimes be contradictory with
> your expectation, but this is a constraint we should accept to simplify
> programming and particularly code sharing.

> Regards,
> Stephane




-- 
Best regards,
 Marcus                            mailto:[EMAIL PROTECTED]

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

Reply via email to