Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20958 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88312 invoked by uid 1010); 1 Dec 2005 16:04:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 88293 invoked from network); 1 Dec 2005 16:04:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Dec 2005 16:04:33 -0000 X-Host-Fingerprint: 84.60.26.23 dslb-084-060-026-023.pools.arcor-ip.net Received: from ([84.60.26.23:2677] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id D8/E3-14828-C0F1F834 for ; Thu, 01 Dec 2005 11:04:28 -0500 Message-ID: To: internals@lists.php.net Date: Thu, 01 Dec 2005 17:03:11 +0100 User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 References: <000601c5f583$2490afb0$5d54edc6@jake> <2E.2A.14828.8F93E834@pb1.pair.com> <5C.BC.14828.95D4E834@pb1.pair.com> <438E6759.90300@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Posted-By: 84.60.26.23 Subject: Re: Desired namespace behavoir From: oliver.graetz@arcor.de (=?ISO-8859-1?Q?Oliver_Gr=E4tz?=) Bart de Boer schrieb: > So, if namespace JessieStuff contains multiple classes. They would all > become JessieStuff_ClassName. > > Assuming the package relies on its own classes, it wouldn't be able to > call them anymore because all their names have changed. First of all, everything INSIDE a namespace is supposed to be able to use its siblings without any namespace operators or prefixes. This is out of scope here. The "import with as" is supposed to be aliasing, not replacing. And for the auto-prefixing, I think of it as an aggressive use of the "as" option of the import statement. An import makes everything that is inside a namespace available in the global namespace. Normally, the names from inside the namespace are kept, so one could use SimpleClass instead of JessieStuff:::SimpleClass. To avoid collisions with OllStuff::SimpleClass, there is the "as" option. And my suggestion is to give Mike an automatism for import with "as" that emulates the current recommendation of prefixing everything: /* * this encounters a namespace. The auto-prefix-import option * is active so EVERYTHING is inside the namespace is imported * with a prefix of "JessieStuff_". */ require 'JessiePackage.php'; $x=new JessieStuff_SimpleClass(); This implements a one-way-availability for packages using namespaces to users hating them. Of course, Mike shouldn't count on successfully sharing his code using Jessie's stuff with others that prefer to use the namespaces. OLLi References: http://en.wikipedia.org/wiki/XML_namespace