You can use zendspace. (Gregory) If you want me to get Johannes patch and convert it to zendspace, just tell me.
So it goes like this: PHP Group: "Good news everyone! PHP now has zendspaces!". PHP users: "WTF???"
Internally in the Zend framework (in a class definition, for exmaple), it can use: package Zend::Foo; import Zend::DB as DB; $c = new DB::Connection(); And internally in the ADO package: namespace ADO::Bar; import ADO::DB as DB; $c = new DB::Connection(); What will happen in this situation?
Exactly what you thought would happen - first one would resolve as Zend::DB::Connection and second one as ADO::DB::Connection. Only note is that you should write not "import Zend::DB as DB" but just "import Zend::DB" - it's prettier this way ;)
If it's internal to a package/namespace, that alias is restricted to THAT package/namespace. If it's not internal to any space, it's global and can be used as expected.
Import'ed alias is always restricted to the file it appeared in.
// Assign namespace in localscope (file scope, based on PHP implementation) import System; // Contains Console class which controle I/O, like C#
"import Something" isn't allowed. Sorry, I know it's not like C++ works, but I don't see any way to make it do anything meaningful without having the same global space pollution problem. Maybe we should rename "import" to "using" or something?
Do you understand the idea now? I can try to explain differently if needed.
From what I understand, it's exactly like it works now with only difference being that "import Foo" is not allowed since it's not doing anything.
-- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php