The purpose of the RFC is to summaries current proposals regarding namespaces.
So far I have two proposals for resolving current namespace debates - one that includes namespaced function and one that does not. This RFC assumes you are familiar with the topic of namespaces in general.
All new functionality relates only to classes. Any code is allowed inside namespace, but only class definitions and references to classes is influenced by it. Class defined in the namespace is prefixed by it's name.
Inside namespace, class definition can be used as:
use Foo::Bar as Fubar; $a = new Fubar::Baz();
Foo::Bar::Baz- take at the face value. Special cases of this are:
::Foo- global name, i.e. explicit reference to non-namespaced class inside namespace
namespace::Foo- name explicitly referring to current namespace
Well, duh, no functions :)
As the above, plus:
Functions and constants defined in the namespace are prefixed with the namespace name.
Quailified function call
A::B::C() is resolved as follows:
A::B::Cas the function name and do the regular function call.
Unqualified function call
foo() inside namespace resolved as follows:
Constants resolved in a way identical to functions.
New syntax for static access is introduced: using
Name→Member is the same as
ClassName->Foo() - static method call ClassName->$Foo - static property access ClassName->Foo - class constant access
Please see also Namespace RFC for more details