Spurred on by a recent post to the php-dev mailing list by Dmitry Stogov the ever-popular "namespaces discussion" has surged back to the top of everyone's list. Dmitry proposed a patch for PHP6 that would easily implement namespaces for the upcoming version.
All class and function names inside are automatically prefixed with namespace name. Inside namespace, local name always takes precedence over global name. It is possible to use the same namespace in several PHP files. The namespace declaration statement must be the very first statement in file.
The general idea is to provide an easy separation of functionality but to keep things accessible at any level (in scope, in parent scope, etc). He's included code in his mailing list post to illustrate how it would all work.
Several others in the PHP community have jumped on and are already talking about this new proposal:
- Evert Pot's post
- a blog entry from Richard Heyes proposing a namespace character
- a new post from the PHP 10.0 Blog on simplicity in namespaces
- this new post from Tony Bibbs
- some thoughts from Tobias Schlitt happily supporting the proposal
- this post from DynamicWebPages.de