Re: AW: AW: [PHP-DEV] PDM Meeting Notes

From: Date: Wed, 23 Nov 2005 17:37:21 +0000
Subject: Re: AW: AW: [PHP-DEV] PDM Meeting Notes
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-20270@lists.php.net to get a copy of this message
Christian Schneider wrote:
    abstract static protected function __construct(CrazySettings $s, CrazyView $v);
<snip>
Static doesn't really make sense as interfaces as object instance related.
Well actually the constructor is implicitly a static function too. The whole allowing/disallowing constructor in interfaces question is in principle exactly the same as allowing static methods in interfaces. Anyway, I see only one use case for interface constructors: interace IConstructableFromBananas { function __construct(Bananas $b); } function thingsThatUseBananasFactory($className) { $class = new ReflectionClass($className); if (!$class->implementsInterface("IConstructableFromBananas")) { trigger_error("$className doesn't implement IConstructableFromBananas", E_USER_ERROR); } return new $className(BananaFactory::getBananas()); } I'm not so sure whether this is useful to anyone, but I don't see it hurting anyone either. Ants

« previous php.internals (#20270) next »