Re: wacky object idea

From: Date: Tue, 29 Aug 2000 15:44:14 +0000
Subject: Re: wacky object idea
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.dev 
Request: Send a blank email to php-dev+get-31083@lists.php.net to get a copy of this message
At 10:34 29-08-00, thies@digicol.de wrote:
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!
It's completely intentional. This feature is for debugging purposes only. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.dev (#31083) next »