Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3761 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58897 invoked by uid 1007); 6 Aug 2003 13:19:38 -0000 Message-ID: <20030806131937.58896.qmail@pb1.pair.com> To: internals@lists.php.net Date: Wed, 06 Aug 2003 10:19:34 -0300 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030529 X-Accept-Language: en-us, en MIME-Version: 1.0 References: <20030802224959.58552.qmail@pb1.pair.com> <20030802230007.65232.qmail@pb1.pair.com> <20030803033323.97051.qmail@pb1.pair.com> <13610291366.20030803105909@post.rwth-aachen.de> <20030803144736.43225.qmail@pb1.pair.com> <20030803195505.18983.qmail@pb1.pair.com> <1639357698.20030803225953@post.rwth-aachen.de> <20030803221049.98562.qmail@pb1.pair.com> <761875207.20030804001846@post.rwth-aachen.de> <20030803223448.11328.qmail@pb1.pair.com> <3F2F5229.5070004@akbkhome.com> <20030805232317.67810.qmail@pb1.pair.com> <1901746316.20030806140736@newmail.ru> In-Reply-To: <1901746316.20030806140736@newmail.ru> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 200.220.252.74 Subject: Re: [PHP-DEV] Re: hook cast_object handler in userspace From: cunha17@uol.com.br (Cristiano Duarte) Simeon Koptelov wrote: > Hello Cristiano, > > Here's why i think that interface is not good solution. > > We need the toString method like java's one to > safely assume that _every_ object has the string representation. This > means we can say $obj1->toString() and $obj2->toString() and don't > care if $obj1 and $obj2 do support this method. In fact we _already_ > have this functionality in ( string )$obj cast -- it's > applicable to any object, doesn't it?. All we need is to formalize > this cast in OOP manner. Interface is only the way to describe what class > can do. If every class can provide it's string representation why should you > implement some interface? > > It's only my $.20 though. > Maybe you're right. I can move the code away from the "cast" function and create a toString method on the "Object" class wich returns "Object id #n". Let's see what the others think about it... Cristiano Duarte