Re: wacky object idea
| From: | thies at digicol dot de | Date: | Tue, 29 Aug 2000 07:34:24 +0000 |
| Subject: | Re: wacky object idea | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31035@lists.php.net to get a copy of this message | ||
On Tue, Aug 29, 2000 at 12:18:44AM +0200, Stig S. Bakken wrote:
> Andrei Zmievski wrote:
> >
> > On Mon, 28 Aug 2000, Andi Gutmans wrote:
> > > Operator overloading is one of the uglier features in C++. Java did things
> > > better. Code is much more readable and maintainable when it uses interfaces
> > > and not "object overloading". You might lose a lot of what PHP is about
> > > when implementing this "cool" feature. You might move PHP coders into
> > > writing unreadable code.
> >
> > This is one of the times when I completely agree with Andi. We have
> > __string_value method support and I suppose it's a nice enough feature
> > for debugging, but I don't see it being used for much more than that.
> > Adding other kinds of automatic object conversions is just going to lead
> > to more mess. Andi is right when he says that using interfaces would be
> > a better approach.
>
> Hm, it I just changed my opinion on this as well (the C++ operator
> overlodaing comparison did the trick :-). I guess I'll just rename all
> the toString methods in PEAR to __string_value.
plz be aware that __string_value() is only called when you
"print" the object (echo $myclass) and _not_ when you cast it to a
string ($b = (string)$myclass). i think we need to fix that!
tc
>
> - Stig
--
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany