Re: Re: Returning PEAR_Error object from constructor
| From: | (Stig Sæther Bakken) | Date: | Wed, 25 Apr 2001 21:39:02 +0000 |
| Subject: | Re: Re: Returning PEAR_Error object from constructor | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-317@lists.php.net to get a copy of this message | ||
[Hans Westerbeek <hw@xs4all.nl>]
> Hi all,
>
> On 25 Apr 2001, Stig [iso-8859-1] Sæther Bakken wrote:
>
> > Zeev, is overwriting $this in the constructor to have "new" return a
> > different object a bug/misfeature or can we rely on it? :-)
>
> To my best OO-knowledge a constructor does not have a return type, not
> even 'void'. Look at some C++ / Java constructors of classes. You will
> never see a 'return' statement in those. I am well aware of the fact that
> PHP != C++ || Java but I do think that the way OO is implemented in those
> languages gives a *very* good idea of how it should be done.
True. That's why the concept never occurred to me before. :-)
> What we need for these error objects is exceptions that can be caught ;-)
> That way we'd get rid of those get_class statements which seem strange to
> me.
>
> Oops i think i'm asking for stronger typing ;-).. Dunno if that is the way
> to go for PHP ;-)
Naah. Although I've seen a looseish-typed language (LPC, for those of
who who know MUDs) become stronger-typed and actually gain execution
performance in the process.
- Stig
--
Stig Sæther Bakken <ssb@fast.no>
Fast Search & Transfer ASA, Trondheim, Norway