Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38639 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76998 invoked from network); 26 Jun 2008 15:57:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2008 15:57:39 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:42579] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/9C-17914-27CB3684 for ; Thu, 26 Jun 2008 11:57:39 -0400 Received: from [83.228.56.37] (port=2575 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1KBtqp-00059s-N7 for internals@lists.php.net; Thu, 26 Jun 2008 10:57:36 -0500 Message-ID: <78783688F8684F4DAD79123AE457B330@pc> To: "internals Mailing List" References: <10845a340806260209g5d22c986tbd14b4234d079590@mail.gmail.com> <4863B271.2080300@php.net> Date: Thu, 26 Jun 2008 18:57:25 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Re: [PHP-DEV] How bad would it be to say/enforce that namespacing can only apply to classes and not normal functions? From: sv_forums@fmethod.com ("Stan Vassilev | FM") >> How bad would it be to say that namespacing can only apply to classes and >> not normal functions? > > Lame, very lame. It would make them unusable for many distributed > projects that are not 100% OOP. Wordpress comes to mind. My own Phorum > as well. > I agree, namespaces need to work for all definition types. I don't see a problem here: 1) ns1::ns2::class::static() and ns1::ns2::namespace::func() is a collision 2) why is it a collision? because we have a class and subnamespace in the same namespace, with the same names. 3) solution therefore is to NOT allow this collision, and end with an error. [Example 1] namespace a::b::c; function foo() {} namespace a::b; class c {} // FATAL ERROR: class collision with existing namespace "a::b::c" [Example 2] namespace a::b; class c {} namespace a::b::c; // FATAL ERROR: namespace collision with existing class "a::b::c" function foo() {} So now, while the syntax may still be ambiguos if a codeline is cut and pasted alone in a blank text file, at least *in context* it can do only one thing: call whatever the user defined/imported/included. If there's a collision, he'll see the error, and take action.