Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31634 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99056 invoked by uid 1010); 16 Aug 2007 17:48:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99040 invoked from network); 16 Aug 2007 17:48:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Aug 2007 17:48:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:14141] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/80-29737-7ED84C64 for ; Thu, 16 Aug 2007 13:48:25 -0400 Received: from [127.0.0.1] ([192.168.16.180]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 16 Aug 2007 10:48:20 -0700 Message-ID: <46C48DE4.6020102@zend.com> Date: Thu, 16 Aug 2007 10:48:20 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Guilherme Blanco CC: internals@lists.php.net References: <46BE14B1.5050209@zend.com> <6094eac50708150709o6d1fe42bx3449af2bc1b7f54d@mail.gmail.com> <46C337F4.5080001@zend.com> <6094eac50708160540w4828a72aka2264dc69c69903@mail.gmail.com> <46C485C9.7000507@zend.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Aug 2007 17:48:20.0933 (UTC) FILETIME=[A2976750:01C7E02D] Subject: Re: [Fwd: Re: [PHP-DEV] Renaming namespaces to packages] From: stas@zend.com (Stanislav Malyshev) > You can use zendspace. (Gregory) If you want me to get Johannes patch > and convert it to zendspace, just tell me. So it goes like this: PHP Group: "Good news everyone! PHP now has zendspaces!". PHP users: "WTF???" > Internally in the Zend framework (in a class definition, for exmaple), > it can use: > > package Zend::Foo; > > import Zend::DB as DB; > $c = new DB::Connection(); > > And internally in the ADO package: > > namespace ADO::Bar; > > import ADO::DB as DB; > $c = new DB::Connection(); > > What will happen in this situation? Exactly what you thought would happen - first one would resolve as Zend::DB::Connection and second one as ADO::DB::Connection. Only note is that you should write not "import Zend::DB as DB" but just "import Zend::DB" - it's prettier this way ;) > If it's internal to a package/namespace, that alias is restricted to > THAT package/namespace. If it's not internal to any space, it's global > and can be used as expected. Import'ed alias is always restricted to the file it appeared in. > // Assign namespace in localscope (file scope, based on PHP implementation) > import System; // Contains Console class which controle I/O, like C# "import Something" isn't allowed. Sorry, I know it's not like C++ works, but I don't see any way to make it do anything meaningful without having the same global space pollution problem. Maybe we should rename "import" to "using" or something? > Do you understand the idea now? I can try to explain differently if needed. From what I understand, it's exactly like it works now with only difference being that "import Foo" is not allowed since it's not doing anything. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com