I just read the new namespace documentation and I must say that the new
implementation is much more flexible.
Great work!
I had only two objections:
- False warnings
As http://php.net/manual/en/language.namespaces.importing.php says, it
is possible to import non-compound name.
// importing a global class
use ArrayObject;
but it generates Warning: The use statement with non-compound name
'ArrayObject' has no effect.
- Relative Resolving
I pointed out to inappropriate relative resolving earlier
(http://news.php.net/php.internals/41837). In the world of well-written
namespaced frameworks the ratio of usage of "more nested" classes vs.
"less nested" is in large majority in favor of the second
(http://news.php.net/php.internals/41980), but PHP prefer the first way.
Now, the new implementation offers way to resolve names relative when it
is needed - using 'namespace' operator (as equivalent of the 'self'
operator). So I think now there is no reason to use default relative
resolving and it should be removed.
What about voting?
David Grudl
Hi!
but it generates Warning: The use statement with non-compound name
'ArrayObject' has no effect.
The warning is correct.
What about voting?
We already voted a lot, let's actually release something for a change.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Hi!
but it generates Warning: The use statement with non-compound name
'ArrayObject' has no effect.The warning is correct.
It is not correct - the use statement has effect, as documented in
manual http://php.net/manual/en/language.namespaces.importing.php.
DG.
The warning is correct.
It is not correct - the use statement has effect, as documented in
manual http://php.net/manual/en/language.namespaces.importing.php.
The manual is wrong. Importing global object is use \ArrayObject - note
the .
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
The warning is correct.
It is not correct - the use statement has effect, as documented in
manual http://php.net/manual/en/language.namespaces.importing.php.The manual is wrong. Importing global object is use \ArrayObject - note
the .
From the look of it it seems like the page there has all 's in the
code skipped (compare comments to the code). Could somebody from the
docs team please fix it?
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
The warning is correct.
It is not correct - the use statement has effect, as documented in manual
http://php.net/manual/en/language.namespaces.importing.php.The manual is wrong. Importing global object is use \ArrayObject - note
the .From the look of it it seems like the page there has all 's in the code
skipped (compare comments to the code). Could somebody from the docs team
please fix it?
Already fixed. The problem is the highlight_string()
function didn't
understand namespaces and magically (and very annoyingly) strip stuff
it doesn't understand.
The box has been upgraded and the weekly updates on friday will fix it.
In the meantime please use
http://docs.php.net/manual/en/language.namespaces.importing.php
-Hannes
Snapshot 5.3.0alpha3-dev acts like manual, I think the manual is correct.
BTW - this is very useful feature. A "wrong-relative-resolving" rescuer ;)
DG.
- Relative Resolving
I pointed out to inappropriate relative resolving earlier (http://news.php.net/php.internals/41837
). In the world of well-written namespaced frameworks the ratio of
usage of "more nested" classes vs. "less nested" is in large
majority in favor of the second (http://news.php.net/php.internals/41980
), but PHP prefer the first way. Now, the new implementation offers
way to resolve names relative when it is needed - using 'namespace'
operator (as equivalent of the 'self' operator). So I think now
there is no reason to use default relative resolving and it should
be removed.
Like Stas said, lets go with what we have and collect some feedback.
Hopefully we will not have to do any larger changes to namespaces
after alpha3, but if we have to we will. That being said I really hope
that people honor the thought process that went into the current
implementation by really giving things a go without prejudice.
Your comments are noted and not ignored.
regards,
Lukas Kahwe Smith
mls@pooteeweet.org