Re: Constructors and Exceptions
| From: | Curt Zirzow | Date: | Thu, 01 Jul 2004 04:06:28 +0000 |
| Subject: | Re: Constructors and Exceptions | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-920@lists.php.net to get a copy of this message | ||
* Thus wrote l0t3k:
> if there is not yet consensus, i'd like to raise the question of how PECL
> developers should handle errors during object construction. in my day job, i
> always raise exceptions in such cases, but were PHP, not Java, C++ or
> Delphi. based on feedback from Wez, i've minimized on my use of exceptions,
> but constructors seem to me to be a special case.
>
> is this pretty much left at the discretion of the extension authors ?
There was a large discussion on the behaviour of exception handling
a few months back on internals. iirc, the decision was to not throw
excepctions in construtors.
For some interesting reading:
http://marc.theaimsgroup.com/?t=108174002300003&r=4&w=2
or (same thread)
http://groups.google.com/groups?threadm=c5d1qs%2410ds%241%40FreeBSD.csie.NCTU.edu.tw&rnum=1
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!