Question about Namespace patch
| From: | Markus Fischer | Date: | Sun, 22 Jul 2007 09:04:21 +0000 |
| Subject: | Question about Namespace patch | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-31157@lists.php.net to get a copy of this message | ||
Hi,
I've a few questions about the namespace patch:
1) Why is "import Foo" a no-op?
Shouldn't it import everything define inside Foo?
2) How can I import all classes from a namespace at once?
Like question 1) actually. "import Foo::*" doesn't work.
3) Shouldn't there be an error when importing a class which already
existing in the current scope? Example
---------------8<--------------------
ns2.php:
<?php
namespace Foo;
class Bar {
public function __construct() {
echo "Namespace class\n";
}
}
ns1.php:
<?php
require_once 'ns2.php';
class Bar {
public function __construct() {
echo "No namespace class\n";
}
}
import Foo::Bar;
new Bar;
C:\...\Desktop\php6>php ns1.php
Namespace class
---------------8<--------------------
I read the thread an I know that I can still call access the global
class with ::Bar ... but is this a intuitive behaviour?
thanks,
- Markus