Re: Constructors and Exceptions
| From: | l0t3k | Date: | Thu, 01 Jul 2004 12:33:06 +0000 |
| Subject: | Re: Constructors and Exceptions | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-924@lists.php.net to get a copy of this message | ||
im totally with wez on this one, but reading the referenced thread, it
seems like this opinion is in the minority. what i'll do for the moment is
allow an optional byref staus parameter. if its present, return an error, if
not raise an exception.
dammit, my head hurts <g>
l0t3k
"Wez Furlong" <kingwez@gmail.com> wrote in message
news:4e89b426040630221375637a0@mail.gmail.com...
> Throwing an exception is the only sane way to handle errors that
> prevent object construction.
>
> If you're excepto-phobic (a new phrase I just invented), then you
> should have no code in your ctor and instead have some kind of start()
> or init() method.
>
> This is, of course, just a waste of cpu--why call two functions when
> you can call one?
>
> --Wez.