Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31172 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87151 invoked by uid 1010); 23 Jul 2007 08:26:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87135 invoked from network); 23 Jul 2007 08:26:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jul 2007 08:26:17 -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:55764] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/04-49395-72664A64 for ; Mon, 23 Jul 2007 04:26:17 -0400 Received: from [127.0.0.1] ([192.168.17.52]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 23 Jul 2007 01:26:12 -0700 Message-ID: <46A4661A.6080202@zend.com> Date: Mon, 23 Jul 2007 01:26:02 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Jeremy Privett CC: Derick Rethans , Markus Fischer , internals References: <46A31D95.2080407@fischer.name> <46A42220.7010600@zend.com> <46A45B12.80402@zend.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 23 Jul 2007 08:26:13.0022 (UTC) FILETIME=[21469BE0:01C7CD03] Subject: Re: [PHP-DEV] Question about Namespace patch From: stas@zend.com (Stanislav Malyshev) > Absolutely not the case. Take a look at C++, C#, even Python. The > "namespaces" implementation of those languages is mostly consistent > (even if Python doesn't call it that). Come on, python modules are not like C++ namespaces at all. For starters, AFAIK, python doesn't even have namespace declaration operator. And module loading and namespacing are combined. > You're not helping developers at all with this implementation. If you're How many developers did you ask, honestly? I had asked some, and they say it helps. Including on the list. You wanted to say I'm not helping some other developers? Well, too bad, there's no patch that can solve everybody's problems :) > working with a large library and have to import a lot of classes, the > way this works is nothing but a pain. We would be better off not using > namespaces at all, in this case. Thus, the problem has not been solved. Once more, you DO NOT have to import a lot of classes. Please do read what I write. You SHOULD NOT import classes in global space. Namespaces are NOT the way to bring all classes in global space, and it should not be done. > Also, for the implementation to be complete, Core Developers and > Extension Developers would need to namespace their classes / functions. Not necessarily. So far PHP core & PECL has been OK without it, there's not too many classes and the names are quite manageable, unless I miss something. > but you still need to offer developers *some* way of importing > everything out of a namespace. I absolutely will have upwards to close No, I don't need that. > to 25 - 30 classes in a single namespace. And sometimes more. To be able > to import them all is an absolute necessity for this implementation to No, it is not an absolute necessity, actually it's exactly the opposite. You don't want each module to inject 30 new names into global space, because you'll be running out of names very, very fast. > the fact that I may be using OTHER libraries as well that may be > namespaced. > > PEAR is a perfect example of this. Look at all the libraries that exist > there. I would absolutely love to just: > > import PEAR; > import PEAR::HTTP; > import PEAR::Image; Yeah, and not since you have generic PEAR exception class, HTTP exception class and image exception class, you've got three exception classes competing with system exception class for the name. Lovely. So now we get PEAR::PEAR_Exception to prevent that, right? So how it's better than just PEAR::Exception? > individual class that I need. And with all of the languages I mentioned > before, that is *exactly* how it works. Of course, we're back to the No, actually it doesn't. In python import - and that's what most use - doesn't bring names into global space. > namespacing of the PHP Core and Extensions. Which is really the main > blocker to any serious namespaces implementation, beyond what's > currently patched to HEAD today, correct? No, incorrect. The main blocker was that all other implementations were either inconsistent, hurting performance or too complex for PHP. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com