New namespace implementation
| From: | David Grudl | Date: | Tue, 02 Dec 2008 21:25:03 +0000 |
| Subject: | New namespace implementation | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-42093@lists.php.net to get a copy of this message | ||
I just read the new namespace documentation and I must say that the new implementation is much more flexible.
Great work!
I had only two objections:
1) False warnings
As http://php.net/manual/en/language.namespaces.importing.php says, it is possible to import non-compound name.
// importing a global class
use ArrayObject;
but it generates Warning: The use statement with non-compound name 'ArrayObject' has no effect.
2) Relative Resolving
I pointed out to inappropriate relative resolving earlier (http://news.php.net/php.internals/41837). In the world of well-written namespaced frameworks the ratio of usage of "more nested" classes vs. "less nested" is in large majority in favor of the second (http://news.php.net/php.internals/41980), but PHP prefer the first way. Now, the new implementation offers way to resolve names relative when it is needed - using 'namespace' operator (as equivalent of the 'self' operator). So I think now there is no reason to use default relative resolving and it should be removed.
What about voting?
David Grudl