Re: AW: AW: [PHP-DEV] PDM Meeting Notes
| From: | Rasmus Lerdorf | Date: | Tue, 22 Nov 2005 20:48:51 +0000 |
| Subject: | Re: AW: AW: [PHP-DEV] PDM Meeting Notes | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20249@lists.php.net to get a copy of this message | ||
Matthias Pigulla wrote:
Now that was a quick reply :)Well, or do a conditional include or an include_once and you end up having to do late binding too. It doesn't have to be as weird as your example, but yes, that works too.Also known as runtime inheritance, or late binding. It's not a new thing, we have it today. The discussion was about whether to have a way... That is, one can write if (...) class A extends X {} else class A extends Y {} right now? Seriously ;)? Every now and then I'm surprised what weird sort of stuff is allowed in PHP :), but most probably you don't really want to write this sort of code in the first place? ;)
I don't see why you can't specify that a class definition must have a constructor. Obviously the constructor is not for the interface itself. -RasmusJust like any other signature in an instance, it tells anything that implements the interface that it must have a constructor and that constructor must meet the definition in the interface. Useful for object factories. In most cases you don't want to force a specific constructor in which case you wouldn't specify it in the interface, but I see no reason why you shouldn't be allowed to specify it there if you want to.The point is that interfaces are nothing you could anything with - that is, if you have "something" that implements an interface, it has already been constructed. You never construct instances through an interface (you would have to choose an implementation, the interface isn't one)... I just cannot explain it in a better way ;) It's somewhat similar to that you cannot make static calls on interfaces.