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



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

Reply via email to