Hello, I've been following the developments of the latest ZE2-enabled PHP for a while, and I feel that some of the work regarding namespaces/nested classes aren't quite doing what they are suppose to. An example:
<?php class Root { class Nested { function Nested() { print("Root::Nested constructed\n"); } } } class Child extends Root { class Nested { function Nested() { parent::Nested(); print("Child::Nested constructed\n"); } } } $object = new Child::Nested; ?> If you attempt to execute this script with the PHP 4.3.0 ZE2 alphas (either 1 or 2), you'll get a fatal error specifying that "Cannot fetch parent:: as current class scope has no parent", referring to the Child::Nested constructor and the "parent::Nested();" line. Is the outer classes just meant to be for namespacing purposes? Any class deriving from the parent will not have its nested classes derive from the parents nested classes. So then why can't nested classes be extended from anything? Just some symbolism: P is parent, defines P.n is nested, D extends P, defines D.n nested, yet D.n has no relation to P.n and is not allowed to extend it explicitly (wouldn't it be implicit, with the same name and all?), nor any other class. Doesn't quite seem to be the intended behaviour or one that does justice to nested class or packaging/namespacing. I think nested classes are themselves a useful language component, but nested classes and namespaces should be handled separately. But then scoping issues come back. Does anyone have any ideas? I'm new to the internals side of PHP so my apologizes if these are non-issues. ---- Pete -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php