Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41147 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3477 invoked from network); 16 Oct 2008 17:08:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Oct 2008 17:08:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 208.83.222.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 208.83.222.18 unknown Linux 2.6 Received: from [208.83.222.18] ([208.83.222.18:48861] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/55-12818-82577F84 for ; Thu, 16 Oct 2008 13:08:56 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 30BDBC10611; Thu, 16 Oct 2008 10:08:47 -0700 (MST) Received: from pcp077519pcs.unl.edu (pcp077519pcs.unl.edu [129.93.148.126]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 91766C1060C; Thu, 16 Oct 2008 10:08:46 -0700 (MST) Message-ID: <48F77525.6060507@chiaraquartet.net> Date: Thu, 16 Oct 2008 12:08:53 -0500 User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070807) MIME-Version: 1.0 To: Lukas Kahwe Smith CC: Stanislav Malyshev , PHP Developers Mailing List References: <48F653FF.5010106@chiaraquartet.net> <48F75FA1.7020505@zend.com> <0C55B977-3835-4CB0-A23B-8AA684B71C18@pooteeweet.org> <48F772ED.3090001@chiaraquartet.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] my last attempt at sanity with namespaces From: greg@chiaraquartet.net (Greg Beaver) Lukas Kahwe Smith wrote: > > On 16.10.2008, at 18:59, Greg Beaver wrote: > >> Lukas Kahwe Smith wrote: >>> >>> On 16.10.2008, at 17:37, Stanislav Malyshev wrote: >>> >>>> B. There's a huge problem with this proposal which you seem >>>> consistently to ignore despite all my attempts to explain it. Failed >>>> autoload on each call is BAD. Very bad. It is not cacheable, it leads >>>> to multiple disk accesses and it is absolutely undetectable to the >>>> PHP user without the use of special tools. So making all existing >>>> code contain this performance bomb unless you rewrite it is very bad. >>>> It's better to have this code fail and provide simple script to fix >>>> it in automatic fashion. The fix you propose - writing use's - is not >>>> enough because as you noted later inertia would make users not to use >>>> this code and thus have huge performance hit - which most of them >>>> even wouldn't know where it came from. >>> >>> first up i am a bit irritated by the use of the term "internal class", >>> i guess you both mean to say "class in the global namespaces"? >> no, we are talking about classes built into PHP such as Exception or >> ArrayObject, not userspace classes without namespace. > > why are they different? > also since they apparently are different, how does this all work when > its not about an internal class, but a global useland class? as in > what if in your example it would not be the Exception class, but a > class called FooBar, which is defined in the global namespace in some > userland code? That's a great question, and I didn't realize it was a confusion, so I'll try to answer it clearly. The purpose behind resolution rules in namespaces is to make it easiest to access 1) stuff with the same namespace prefix 2) internal functions, constants, and classes built into PHP So, there is no chance for conflict with this code: foo.php: To force resolution to userspace Foobar, all you need add is: Greg