Hi,
Some questions about namespaces now that PHP 5.3 continues to evolve
1) Do we need functions in namespaces now that we have closures?
One of the main reasons I wanted functions in namespaces was to
implement callbacks. Now that we have closures in PHP 5.3, for me there
is no longer any good reason to have functions in namespaces other than
porting legacy code.
Because the only remaining serious naming conflict is between namespaced
functions and static class methods, I wonder how many people would find
closures an acceptable substitute for allowing functions in namespaces?
Also, see #3 as a way to solve the question of porting old code.
My assumption is that namespaces are best as a library helper for
re-usable classes.
2) Do we really need namespaced constants?
These can conflict with class constants and there is no way to resolve
the difference external to that namespace.
3) Now that it has been pointed out that use can't be used in brackets,
could we consider moving namespace syntax to a syntax proposal Dmitry
made a while ago:
<?php
namespace Foo {
}
namespace Bar {
// this shows how to port legacy code - you simply have to explicitly
use old functions.
use ::blah();
}
namespace {
function blah(){}
}
?>
The last example would be for porting legacy un-namespaced code (for
instance, utility functions) or global application code that uses the
previous stuff.
If possible, could answers to these questions be limited to +1/-1? I
would like to get a sense of how controversial these ideas are rather
than to just debate them. If you absolutely must reply with other
ideas, then please start a new thread.
Thanks,
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php