Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38634 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47508 invoked from network); 26 Jun 2008 09:09:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2008 09:09:47 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 72.14.220.158 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 72.14.220.158 fg-out-1718.google.com Received: from [72.14.220.158] ([72.14.220.158:23306] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/A5-13482-7DC53684 for ; Thu, 26 Jun 2008 05:09:44 -0400 Received: by fg-out-1718.google.com with SMTP id 16so1804270fgg.23 for ; Thu, 26 Jun 2008 02:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:mime-version:content-type; bh=C6qX8v42k19I5ymTr8ctPzc4coqboeFpsAQ0xwhS4Cs=; b=nhFB+RgICifrf6BHeZh6+8j7kS1kUXtXt/AUi/ROiMmSwZy3N5FOMQh1Qji4jofMq4 9JOviECXlt8CwW/WTSStoQmwx8DfowigzakqMggWJY6b98nedpIY+kaCPgdEvvg74qQ8 Jc1KIdFfLhJlC6w1nm6qgHr/ZnoRPvCTWwFtk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:mime-version :content-type; b=h+Ir69yp8XID4lNGjd22rcI5cdXfQnVqdTKTG2fwn0r65K7lW6xOVn0sEflvLi11Ij s3miW70Q5KMg5drNc0nUAAgiuzgQCqnSj+fnne3bKAcVPP2tHN26k8GzO1jPZLYO8yZQ iniXASs37FVEPx3uqjZXF0Hc93+C/K6heJPbg= Received: by 10.86.87.5 with SMTP id k5mr11889891fgb.59.1214471379763; Thu, 26 Jun 2008 02:09:39 -0700 (PDT) Received: by 10.86.97.3 with HTTP; Thu, 26 Jun 2008 02:09:39 -0700 (PDT) Message-ID: <10845a340806260209g5d22c986tbd14b4234d079590@mail.gmail.com> Date: Thu, 26 Jun 2008 10:09:39 +0100 Reply-To: RQuadling@GoogleMail.com To: "Derick Rethans" Cc: "Rasmus Lerdorf" , "internals Mailing List" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4803_3752462.1214471379750" Subject: How bad would it be to say/enforce that namespacing can only apply to classes and not normal functions? From: rquadling@googlemail.com ("Richard Quadling") ------=_Part_4803_3752462.1214471379750 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2008/6/26 Derick Rethans : > On Tue, 24 Jun 2008, Rasmus Lerdorf wrote: > > > Derick Rethans wrote: > > > On Tue, 24 Jun 2008, Alexey Zakhlestin wrote: > > > > > > > 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. > > Actually, the point that I was trying to make is that we instead of > encouraging this confusion, we should put somewhere in our userland > nameing guidelines that you still would need to provide a prefix to your > (aliased) classnames in order to prevent confusion. But that then > seriously means I see no real good reason still why people want > namespaces with confusing resolving rules (concerning static methods > like Greg points out). > > regards, > Derick > > -- > Derick Rethans > http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > How bad would it be to say that namespacing can only apply to classes and not normal functions? So. class::static(); namespace::class::static(); namespace::namespace::class::static(); they always work. namespace::function() would fail as namespace would be seen as class. If a class and a namespace share the same name ... namespace::function() vs class:static()... how is anyone, let alone PHP, going to know. It can't. If both forms relate to a valid entity, then it is always a guess as to which is intended. You could make namespace:: have a higher precedence than class:: (or the other way around). But that feels like a fudge rather than a fix. So, maybe, in the short tem, namespacing only applies to classes. It was my understanding that one of the primary reasons for introducing namespacing was to protect against userland_class vs builtin_class collision. Regards, Richard Quadling. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" ------=_Part_4803_3752462.1214471379750--