The other thing that bothers me is namespaces nesting. It was said
that namespaces
nesting is not supported. Then I'm missing a point in having namespace
named "A::B".
The same reason some people write $a = f($z, $t) and some write
$parsed_template = template_parser($template, $data_values) :)
Lets say I have three files:
a.php:
<?php
namespace A;
function foo()
{
}
?>
b.php:
<?php
namespace A::B;
function bar()
{
//foo();
}
?>
index.php:
<?php
require 'a.php';
require 'b.php';
import A;
foo(); // should call A::foo(), right?
B::bar(); // will this call A::B::bar()?
?>
import A is a no-op. You do import A::B and then you can do B::bar.
import N means "something that is named N can now be referred only by
it's 'last name' last(N), last name being last segment of the long
name". If you have short names, you don't need namespaces, but if you
have names like PEAR::DB::Record::Type::Modifier::Exception, you
probably do :)
Now if this does not work then whats the point in having namespace
"A::B" instead of "A_B"? IMHO this brings more confusion then
clearness.
The point is you can a) omit namespace prefix inside namespace and b)
use just B (or C if you wish) instead of A::B outside, once you did
import. As I said, with long names it makes sense, with short ones you
are OK without it.
--
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