Re: PEAR's Error Handling and PHP5
| From: | Hans Lellelid | Date: | Wed, 21 Jun 2006 15:28:54 +0000 |
| Subject: | Re: PEAR's Error Handling and PHP5 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-43057@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
> anyways the point was:
> if we add support for this (which means adding an isInstanceOf() method
> to all classes) then the choice is in the hands of the user. if we dont
> then it isnt unless we stick with PEAR_Error. remember we can throw
> execeptions from a PEAR_Error callback and not the other way around.
Another option would simply be that you, the developer [who would prefer
to have PEAR_Error returned], can use your proxy idea to wrap any object
that throws exceptions and have them returned as PEAR_Error. (I was
sure I posted that suggestion to your blog, but I guess it never showed up?)
Either way, though, the problem I see with proxy classes in PHP is that
they are not very seamless: 1) you cannot use instanceof (as you note)
or any of the class introspection functions; 2) you cannot use type
hints; and 3) proxied classes can't make use of the SPL interfaces. I'm
sure there are other problems too, but that already cuts out a fair
number of the new PHP5 OO features. Since we're only talking about PHP5
anyway, it doesn't make sense to me to dumb down the OO features
available to packages in an attempt to make everyone happy. (Of course,
on that note, I also consider PEAR_Error to be a dumbing down of the OO
features of PHP5.)
Hans