Marcin Kurzyna wrote:
> <?php
>
> namespace foo;
>
> use bar as A; /// ->resolves as A == \foo\bar
> use \bar as B; /// ->resolves as B == \bar
>
> ?>
Hi Marcin,
Stan also requested this, so it should be considered as a possibility.
Personally, I would rather not introduce this land mine. It requires
the user to do an implicit prepending of namespace name ("foo") to "bar"
in the use statement as well as a translation of "A", which could fast
lead to unreadable code.
It is probably best to simply require a fully qualified name where it is
intended. Thus
1) require leading "\" in use statements
2) allow "namespace\blah" in use statements, as this is a valid fully
qualified name.
<?php
namespace my\ns;
// this is a better way to do the suggested "use bar as A;"
use namespace\bar as A;
use \bar as B;
class mine extends \my\parentclass {}
?>
Stas, I'm sure you have an opinion on this?
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php