Re: aggregate() und overload()
| From: | Kristian Köhntopp | Date: | Fri, 05 Apr 2002 09:31:28 +0000 |
| Subject: | Re: aggregate() und overload() | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82129@lists.php.net to get a copy of this message | ||
Kristian Köhntopp wrote:
> In fact, setters, getters and wrappers provide a great
> policy-agnostic mechanism to introduce policies of the
> implementors choosing.
A final note: Sebastian told me that in ZE 2, constructors and
destructors have a fixed name like __construct() and
__destruct(). If so, the following breakage cannot be reproduced
in PHP with ZE 2, which is good.
Example:
class __get {
function __get() {
echo "I am the constructor for __get\n";
}
}
class Bomb extends __get {
...
}
overload("Bomb");
$bang = new Bomb;
Because Bomb does not have a constructor, the inherited
constructor __get() is called. Because Bomb is overloaded, this
also is a getter. This is not sane, but hopefully will not be an
issue in ZE 2 based PHPs.
Shouldn't overload() be enabled on all clases, just as
constructors are? This will pretty much avoid the issue, I think.
Kristian