Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31230 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53768 invoked by uid 1010); 24 Jul 2007 00:43:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 53753 invoked from network); 24 Jul 2007 00:43:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2007 00:43:17 -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 216.148.227.153 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 216.148.227.153 rwcrmhc13.comcast.net NetCache Data OnTap 5.x Received: from [216.148.227.153] ([216.148.227.153:57996] helo=rwcrmhc13.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/2F-45888-02B45A64 for ; Mon, 23 Jul 2007 20:43:12 -0400 Received: from earth.ufp (c-71-228-13-89.hsd1.il.comcast.net[71.228.13.89]) by comcast.net (rwcrmhc13) with ESMTP id <20070724004309m13006q2lue>; Tue, 24 Jul 2007 00:43:09 +0000 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id CFF70D815F for ; Mon, 23 Jul 2007 19:43:08 -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 Qd18J6cbcfCQ for ; Mon, 23 Jul 2007 19:43:08 -0500 (CDT) Received: from vulcan.ufp (vulcan.ufp [192.168.42.4]) by earth.ufp (Postfix) with ESMTP id B1C3FD815D for ; Mon, 23 Jul 2007 19:42:58 -0500 (CDT) To: internals@lists.php.net Date: Mon, 23 Jul 2007 19:42:56 -0500 User-Agent: KMail/1.9.6 References: <46A31D95.2080407@fischer.name> <46A4F613.6020807@fischer.name> <1CFA45A3-023A-4E62-8507-63AD00ED10AC@bitxtender.com> In-Reply-To: <1CFA45A3-023A-4E62-8507-63AD00ED10AC@bitxtender.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-ID: <200707231942.57226.larry@garfieldtech.com> Subject: Re: [PHP-DEV] Question about Namespace patch From: larry@garfieldtech.com (Larry Garfield) I'm fine with single-import-with-alias, from the descriptions here. =20 Effectively, then, there is no concept of "import". There is just an alias= ,=20 and mass-operation aliasing is quite messy. I am more curious how far it goes in the supporting utilities. I saw that= =20 there is a __NAMESPACE__ constant, which is nice. Is there also a way to g= et=20 the "full name" of a function or class, so you can see where it came from? = =20 Does import work for functions as well as classes? =20 Where I can see a huge use for namespaces is plugin-based architectures. E= ach=20 plugin is its own namespace. If you have a list of plugins, then you have = a=20 list of namespaces and can iterate over that and invoke the same operation = on=20 each plugin. That would require call_user_func() and call_user_func_array(= )=20 and the rest of that family to be able to handle namespaces. How would one= =20 do that? Vis, is the callback type[1] namespace aware, or does it not have= =20 to be? (If this is already documented somewhere, please let me know where.) [1]=20 http://us.php.net/manual/en/language.pseudo-types.php#language.types.callba= ck On Monday 23 July 2007, David Z=FClke wrote: > That's exactly how import w/ aliasing is supposed to be used, you got > that perfectly right. > > > David > > Am 23.07.2007 um 20:40 schrieb Markus Fischer: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hi Andrew, > > > > Andrew Minerd wrote: > >> Well, first of all, not exactly. I think you meant: not import > >> everything from two or more namespaces with conflicting names. > >> Secondly, that's not the only solution. You could import > >> everything from one, and not import from the other (or use a > >> shorter prefix). Thirdly, you're not preventing collisions _at all_: > >> > >> import Zend::DB; > >> import My::DB; > >> import Woot::Database as DB; > > > > I don't quite understand your example. When I look at it in real > > life, I > > would go for: > > > > import Zend::DB as ZBD; > > import My::DB as MDB; > > import Woot::Database as DB; > > > > I mean, that's is the point, to have more readable code =3D=3D shorter > > identifiers, isn't it? > > > > So your code continues to read (just made up): > > > > $oZdb =3D ZDB::factor('mysql'); > > $oMdb =3D MDB::getInstance('oracle'); > > $oWdb =3D DB::getDriver('postgres'); > > > > instead of: > > > > $oZdb =3D Zend::DB:factor... > > $oMdb =3D My::DB::getInstance > > $oWdb =3D Woot::Database::getDriver.. > > > > Isn't that a win, at last? > > > > That's how I understood. Maybe I got that wrong. > > > > - - Markus > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.6 (MingW32) > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > iD8DBQFGpPYT1nS0RcInK9ARAmQmAKDGsYj/ZY0FNojQobKb3bK2NL6QDgCcDKgl > > LnyIP65ymnx180f7/WD5WfM=3D > > =3DLjpG > > -----END PGP SIGNATURE----- > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php =2D-=20 Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of=20 exclusive property, it is the action of the thinking power called an idea,= =20 which an individual may exclusively possess as long as he keeps it to=20 himself; but the moment it is divulged, it forces itself into the possessio= n=20 of every one, and the receiver cannot dispossess himself of it." -- Thomas= =20 Jefferson