Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace
| From: | Simeon Koptelov | Date: | Wed, 06 Aug 2003 08:07:36 +0000 |
| Subject: | Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-3753@lists.php.net to get a copy of this message | ||
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.
--
Best regards,
Simeon mailto:xi@newmail.ru