Re: Question about Namespace patch
| From: | Andrew Minerd | Date: | Tue, 24 Jul 2007 19:18:10 +0000 |
| Subject: | Re: Question about Namespace patch | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31243@lists.php.net to get a copy of this message | ||
On Tue, 24 Jul 2007 11:53:38 -0700
stas@zend.com (Stanislav Malyshev) wrote:
> > Where I can see a huge use for namespaces is plugin-based architectures. Each
> > plugin is its own namespace. If you have a list of plugins, then you have a
> > list of namespaces and can iterate over that and invoke the same operation on
> > each plugin. That would require call_user_func() and call_user_func_array()
> > and the rest of that family to be able to handle namespaces. How would one
>
> Since namespace is just a part of class name, I don't see any problem
> for call_user_func() to be able to use namespaced names. Of course, they
> should get full class name - if you want to use shorter ones you'd have
> to change something. Here we might need some functionality, but it's not
> clear to me yet which one.
>
>
w/ snapshot from yesterday:
andrewm@ds38 /usr/local/src/php6.0-200707232030 $ cat ./namespace3.php
<?php
namespace test;
class Blah { static function test() { echo "Test\n"; } }
call_user_func(array(__NAMESPACE__.'::Blah', 'test'));
?>
andrewm@ds38 /usr/local/src/php6.0-200707232030 $ ./sapi/cli/php ./namespace3.php
Test
Andrew Minerd
Software Architect
The Selling Source, Inc.