Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38583 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46476 invoked from network); 24 Jun 2008 15:04:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jun 2008 15:04:45 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:49329] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/1C-17106-B0D01684 for ; Tue, 24 Jun 2008 11:04:45 -0400 Received: from [192.168.200.148] (c-24-6-219-206.hsd1.ca.comcast.net [24.6.219.206]) (authenticated bits=0) by mail.lerdorf.com (8.14.3/8.14.3/Debian-4) with ESMTP id m5OF4ew2028325; Tue, 24 Jun 2008 08:04:40 -0700 Message-ID: <48610D08.2030604@lerdorf.com> Date: Tue, 24 Jun 2008 08:04:40 -0700 User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) MIME-Version: 1.0 To: Derick Rethans CC: internals Mailing List References: <485BD1C0.8040302@chiaraquartet.net> In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (mail.lerdorf.com [204.11.219.139]); Tue, 24 Jun 2008 08:04:41 -0700 (PDT) Subject: Re: [PHP-DEV] simple solution to another namespace conundrum? From: rasmus@lerdorf.com (Rasmus Lerdorf) Derick Rethans wrote: > On Tue, 24 Jun 2008, Alexey Zakhlestin wrote: > >> On Tue, Jun 24, 2008 at 6:36 PM, Derick Rethans wrote: >>> On Fri, 20 Jun 2008, Gregory Beaver wrote: >>> >>>> The user is obviously intentionally creating a "DateTime" class, and >>>> doesn't care about the internal classname in this script. >>>> >>>> The attached patch against PHP_5_3 would fix the issue by eliminating >>>> the check for conflict with CG(class_table) in the global namespace for >>>> internal classes. It however preserves this check for userspace classes >>>> so that (for instance) php-src/tests/Zend/ns_030.phpt does not fail. >>>> The basic idea is that we do have control over the userspace classes we >>>> include, but have no control over the internal classes. >>> I am not so sure this is a good idea. I mean, for the developer that >>> writes the code it's obvious that his version of DateTime is used. But >>> for a second developer to come back later this could be a great WTF >>> factor a few years down the road - wondering why the DateTime >>> documentation on php.net doesn't match with what the class does. >> it won't be a serious 'wtf', as on the top of the file, there would be >> some kind of >> use MySuperLibrary::DateTime; > > I know, but 400 lines down in the code you can't really see that. This > addition might fix the immediate issue - but it doesn't make life easier > for the developers that have to maintain the code. Even less if they're > not aware that stuff is namespaced. If we don't allow it to work this way, then I really don't see the point in namespaces at all, which I assume is the point you are trying to make. But, assuming at this point that we do want namespaces, then we have to make them work, and by its very nature namespacing involves code obfuscation. With or without this change, having the same userspace functions in different namespaces provides the same level of code obfuscation where a line of code read in isolation is impossible to resolve without looking at its namespace context. -Rasmus