a) Introduce a special name to refer to the current namespace (as self::
works for the current class).
namespace::
All namespace access should be explicit:
Consequence: nobody uses namespaces, as it's too annoying.
b) Name aliasing with use should only generate namespaces aliases:
See no reason for that limitation. Used in moderation, class aliasing is OK. Main thing is not to rely on it for everything.
2) Using :: as namespace separator generates ambiguity
Would that be 20th reincarnation of "let's find weirdest namespace separator" thread? :)
<?php
...
Foo::test(); // a member function? a namespaced function?
?>
Sometimes you need context. When you just take $foo->bar() it doesn't give you much - you should know what $foo is and what bar() does.
Why is this an argument against: there was not a construct that works as
this one in PHP.
This is not an argument - each construct works as needed for it to work to achieve its purpose.
c) If bracketed namespaces are a no-go, consider the possibility of
declaring the full name of the namespaced element in its definition:
Which would lead to people routinely mixing different namespaces inside one file. Bad idea. Also would kill namespaced functions and constants, which would make organizing libraries using those impossible.
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com