Hi!
1) commit of namespace brackets support
2) review by Stas for any problems
Once these two things are done, I'll commit. For those interested, I
have a draft up at
http://pear.php.net/~greg/nsdocs/language.namespaces.html
In general, good work, thanks! My notes:
1. namespace\ is not operator. It's a keyword, which can be used instead
of current namespace name.
2. Sub-namespace is an unfortunate name - there's nothing "sub" in
MyProject\Sub\Level, maybe better to call it "multi-component names"
etc. In general, single- and mutli-component names work exactly the
same, so I'm not sure they should have separate chapters - just show in
one chapter that name can be foo or foo\bar\baz and that's it.
3. In "Using namespaces: Basics" the fallback should be mentioned
immediately, otherwise readers that don't read whole page would not know
it exists.
4. Many examples have \\ inside single quotes - this should be fixed. In
single quotes, single slash is enough.
5. I don't like "echos" when describing output - maybe better "outputs"?
6. Import chapter should mention special case of:
use \GlobalClass;
which can be used to use GlobalClass without qualifying (unlike use
GlobalClass which is just a NOP). Also, it'd be nice to explicitly say
that even though you can use both My\Full\Classname and
\My\Full\Classname, they are the same in this context since imports do
not need qualification.
7. In rules, imports influence all class names, both qualified and
unqualified. They do not influence fully qualified ones, though - like
\foo\bar.
8. namespace\Foo is a fully qualified name too.
9. "Inside namespace, calls to unqualified functions that are defined in
the current namespace and are in the same file are interpreted as calls
to these namespace functions, at compile time." - IIRC this is not true
currently.
10. items 7 and 8 say basically the same. And autoloading is part of
looking for the class, so it's not two-step process, actually - it's
one-step process which applies to all class names, and the class name is
always resolved compile-time, no matter what.
11. Undefined constants that are not qualified can be substituted as
string (echo FOO outputs FOO), but any qualification would lead to
undefined constant produce an error.
12. I would not call not nesting namespaces "pitfall" - it has a meaning
of unexpected negative effect, but we actually did it intentionally.
Maybe "limitations" or "restrictions"?
13. "Dynamic namespace names (quoted identifiers) should escape
backslash" should be "Use single quotes!"
14. Somewhere we should mention you cannot override special constants
like NULL, true, false, etc.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED] http://www.zend.com/
(408)253-8829 MSN: [EMAIL PROTECTED]