nested namespace
[email protected] (Greg Beaver) Fri, 07 Mar 2003 11:58:49 -0500
| Newsgroups | php.dev |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm wondering if a note of clarification could be added to ZEND_CHANGES.
The sentences:
A namespace's name may contain colons to denote "sub-namespaces".
This is pure syntactic sugar, the Zend Engine will not see, for
instance, the namespaces "Package", "Package:Subpackage" and
"Package:Subpackage:Subsubpackage" as related.
will possibly be clearer if modified like:
A namespace's name may contain SINGLE colons (:) to denote
"sub-namespaces". This is pure syntactic sugar, the Zend Engine
will not see, for instance, the namespaces "Package",
"Package:Subpackage" and "Package:Subpackage:Subsubpackage" as related.
DOUBLE colons are used to distinguish between nested namespaces as in
"Package::Subpackage." A namespace identifier may not begin with a colon.
namespace Package {
const one = 1;
namespace SubPackage {
const one = 'one';
}
}
namespace Package:Subpackage {
const one = 'einz';
}
echo Package::one; // 1
echo Package::Subpackage::one; // one
echo Package:Subpackage::one // einz
This is assuming I understand namespaces. Modify as needed.
Regards,
Greg