Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41769 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75139 invoked from network); 7 Nov 2008 21:53:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2008 21:53:31 -0000 Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 74.125.92.27 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 74.125.92.27 qw-out-2122.google.com Received: from [74.125.92.27] ([74.125.92.27:47871] helo=qw-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/81-02726-BD8B4194 for ; Fri, 07 Nov 2008 16:53:31 -0500 Received: by qw-out-2122.google.com with SMTP id 8so799359qwh.59 for ; Fri, 07 Nov 2008 13:53:28 -0800 (PST) Received: by 10.214.26.3 with SMTP id 3mr4804994qaz.331.1226094808833; Fri, 07 Nov 2008 13:53:28 -0800 (PST) Received: from ?192.168.0.106? ([76.84.4.101]) by mx.google.com with ESMTPS id 26sm1417550qwa.8.2008.11.07.13.53.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 07 Nov 2008 13:53:27 -0800 (PST) Message-ID: <4914B8F2.1000407@chiaraquartet.net> Date: Fri, 07 Nov 2008 15:53:54 -0600 User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: Stan Vassilev | FM CC: internals Mailing List References: <4914AFCA.40307@chiaraquartet.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] bracketed namespace declarations From: greg@chiaraquartet.net (Gregory Beaver) Stan Vassilev | FM wrote: > // global, scope 1 > > namespace { // global, scope 2 } > > // global, scope 1 > > namespace { // global, scope 3 } > > // global, scope 1 > > namespace foo\bar { // foo\bar, scope 4 } > > // global, scope 1 > ?> I am afraid I must shed my generally congenial public nature to express a strong opinion: This is a horribly complex idea Stan. PHP's implementation of namespaces do not define scope. Once we open that Pandora's box, there is no turning back. Big time -1 from me. Remember, the patch I'm proposing would only be necessary for people using un-namespaced code combined with namespaced code (already a bad idea) *and* scattering "use" statements throughout the global code. Also, the *only* supported use case behind allowing multiple namespaces per file is to allow people to mash pre-existing separate PHP files together, and have them still compile. Requiring brackets is designed to make it more readable, and the "use" restriction furthers that goal. I would have implemented this requiring all code to be encased in namespace {} or namespace nsname {}, but that turned out to be virtually impossible in the parser because of the need to also allow "declare" statements outside namespace declarations Thanks, Greg