Re: OO in PHP5 (was "zend_API.c" on php-dev)
| From: | Harald Radi | Date: | Tue, 04 Feb 2003 12:05:43 +0000 |
| Subject: | Re: OO in PHP5 (was "zend_API.c" on php-dev) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-93991@lists.php.net to get a copy of this message | ||
?
harald
"Timm Friebe" <thekid@thekid.de> schrieb im Newsbeitrag
news:<1044352391.22055.58.camel@localhost>...
> On Mon, 2003-02-03 at 21:20, Harald Radi wrote:
> [...]
> > when called as function -> print warning
> > when called as method -> throw exception
>
> What exception? There are no builtin exceptions and IMHO it would be
> better to leave writing such up to the user.
>
> E.g. I'd like to be able to have _all_ my classes extend my Object
> class, including my own Exception class. Plus, I prefer the Java style
> notation "Exception::getMessage", "Exception::toString",
> "Exception::printStackTrace", "Exception::getStackTrace",
> "Object::getClass".
>
> If any exception class were to be integrated into PHP5, it would:
> a) not extend my Object class
> b) probably have methods such as get_message (following the PHP
> naming conventions)
> c) not have getStackTrace return an array of "StackTraceElement"s.
>
> Other users might prefer differing notations in their framework, will
> disagree on inheritance issues with Object ("this is unneccessary
> bloat") or want a slightly different stack trace (consisting of an
> associative array, not those stupid StackTraceElement things).
>
> This has actually been discussed on the engine2-List and IIRC,
> builtin-anything-classes being forced on users was decided against. Side
> note: Whithin the mentioned thread, even amongst those liking the idea
> of builtin exceptions, no consensus on how to name these classes could
> we reached (Exception? exception? __exception?).
>
> Conclusion: Don't even try to write exception classes for PHP5 in C. You
> will never please all of the users' needs - so simply leave it up to
> them.
>
> - Timm
>
>