Greg Beaver wrote:
Hi,
http://wiki.php.net/rfc/namespaceissues
Read it and discuss. Let's be clear people: the technical problems in
namespaces are limited and solvable. The problems in the political
environment surrounding them may not be. Wouldn't politics be a
stupid-ass reason to remove namespaces?
Greg
Hi Greg,
I've read through the posts and the RFC and am not sure if this was
discussed before, but there is one other proposal I'd like to throw out
there: why not require all classes that are inside namespaces to be
explicitly imported? This would follow the AS3 approach
(http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/statements.html#import).
I believe this would solve the issue with the namespace separator at
compile-time. The namespace separator can be left as :: and would only
be used in certain cases, such as when creating objects dynamically
(i.e. <code>$c = 'MyNs::MyClass'; $o = new $c;</code>). The double-colon
would work dynamically, since at runtime you can tell what's a namespace
and what's a class.
So the class resolution rules would change to the following:
1) If the class was explicitly use'd, then use that class.
2) If not, look for the class in the global namespace (this would
include internal classes).
If one wanted to have a custom Exception class inside a namespace, one
would first alias the core Exception class and then extend from that:
<?php
use Exception as PhpException;
class Exception extends PhpException {}
?>
Thoughts, comments?
--
Jessie Hernandez
Zend Certified Engineer (http://zend.com/zce.php?c=ZEND006359&r=222727282)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php