Re: Re: RFC: Dropping Namespace

From: Date: Wed, 05 Dec 2007 01:21:43 +0000
Subject: Re: Re: RFC: Dropping Namespace
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-33704@lists.php.net to get a copy of this message
However, in the global scope (no namespace) it would fail. This is a bug that is easily fixed. use should allow re-aliasing of global classes, and I could provide a very easy fix.
This is not a bug - since there you work with test::xmlreader, which of course you can define. But in global space you'd work with existing name xmlreader, which would be redefined. And PHP never allowed redefining classes.
file1.php: <?php class DB {} ?> file2.php: <?php import DB as Other_DB; include 'file1.php'; class DB extends Other_DB {} ?>
You mean 'use' should kill the old name? I don't think it's a good idea - we'd have to keep track of killed names, and since class can be named in a lot of ways - i.e. if you have name A::B::C::D you can alias any part of name, it would become messy. Why exactly you need to rename existing classes? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#33704) next »