Hello,
It is too early to do anything concrete, but I wonder if PHP 5.1 or
later could add a non-fatal version of throw to handle
warnings/errors/notices.
A trigger_error()
that accepted an object similar to Exception would be
a good solution. This way, all the benefits of the Exception class
could be used in a non-fatal context, without requiring a new language
construct. Overloading the function signature in this way would give
complete customization, and would make the need for the hacks like
PEAR_ErrorStack (however elegant) that we see all around us obsolete.
user error handlers would have to append another parameter that would
contain the object passed in, in order to maintain proper BC, but that
would be fine.
As Alan pointed out, there are no languages that provide both elegant
Exception and elegant warning/notice handling, perhaps PHP5 could be the
first.
Thanks,
Greg