Matthias Pigulla wrote:
2.10 Dynamic class inheritance
Can someone elaborate a little on what this is supposed to be ;)?
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
to disable this and force people to define their classes at the
top-level of scripts and to define them in the correct order so all
binding can be done at compile-time which is of course faster. The
conclusion was that this could be done at the opcode cache level.
I had a discussion about this with a colleague recently. IMHO specifying
construcor signature does not make sense at all in interfaces... What is
that supposed to do at all? I mean - conceptually, what does it express?
Just 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.
As to type hinting, has there ever been a discussion about allowing
string/int/... type hints? These could perform appropriate casts so you
don't need to make such checks at the beginning of every method you
write.
Yes, a lot of folks are strongly against going down that route.
-Rasmus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php