Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31249 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38416 invoked by uid 1010); 25 Jul 2007 00:54:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38401 invoked from network); 25 Jul 2007 00:54:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2007 00:54:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 204.127.200.85 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 204.127.200.85 sccrmhc15.comcast.net NetCache Data OnTap 5.x Received: from [204.127.200.85] ([204.127.200.85:38702] helo=sccrmhc15.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/DA-14257-34F96A64 for ; Tue, 24 Jul 2007 20:54:27 -0400 Received: from earth.ufp (c-71-228-13-89.hsd1.il.comcast.net[71.228.13.89]) by comcast.net (sccrmhc15) with ESMTP id <200707250054140150020avme>; Wed, 25 Jul 2007 00:54:23 +0000 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id 6DD6DD8161 for ; Tue, 24 Jul 2007 19:54:14 -0500 (CDT) Received: from earth.ufp ([127.0.0.1]) by localhost (earth.ufp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aPdNj2IBmuaC for ; Tue, 24 Jul 2007 19:54:14 -0500 (CDT) Received: from vulcan.ufp (vulcan.ufp [192.168.42.4]) by earth.ufp (Postfix) with ESMTP id 4742ED7C10 for ; Tue, 24 Jul 2007 19:54:04 -0500 (CDT) To: internals@lists.php.net Date: Tue, 24 Jul 2007 19:54:02 -0500 User-Agent: KMail/1.9.6 References: <46A31D95.2080407@fischer.name> <46A64AB2.5010301@zend.com> <20070724121810.7443a5a6@h4x0r.tss> In-Reply-To: <20070724121810.7443a5a6@h4x0r.tss> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200707241954.02823.larry@garfieldtech.com> Subject: Re: [PHP-DEV] Question about Namespace patch From: larry@garfieldtech.com (Larry Garfield) On Tuesday 24 July 2007, Andrew Minerd wrote: > 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 > 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 Mm, nice. And presumably the same would work for any other namespace, and for functions as well as classes/objects. That should make plugin architectures, both OO and non-OO, a lot cleaner. Spiffy. :-) Do __autoload() and the SPL autoload stack get namespace information as well? I didn't get that from the mail archive link posted yesterday. -- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson