Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32238 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4397 invoked by uid 1010); 11 Sep 2007 09:34:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 4382 invoked from network); 11 Sep 2007 09:34:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2007 09:34:41 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:36123] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/19-48550-03166E64 for ; Tue, 11 Sep 2007 05:34:40 -0400 Received: from dhcp-172-28-204-149.zrh.corp.google.com (unknown [193.142.125.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 31ED31B3622; Tue, 11 Sep 2007 11:34:37 +0200 (CEST) Date: Tue, 11 Sep 2007 11:34:36 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1869442285.20070911113436@marcus-boerger.de> To: Stanislav Malyshev CC: 'PHP Internals' In-Reply-To: <46E5D163.4050800@zend.com> References: <46E5D163.4050800@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] multiple namespace per file From: helly@php.net (Marcus Boerger) Hello Stanislav, Tuesday, September 11, 2007, 1:21:07 AM, you wrote: > Hi! > Following the feedback from the community, we (mostly me and Dmitry) > tried to find a good model that would allow multiple namespaces per file > without running into too many problems and complications, and would > allow to bundle multiple namespaced files together without > modifications. It looks like it is possible to do, but only under the > following condition: the file can have multiple namespaces, but if the > file has namespaces, then it can have no code outside namespaces. > For example, this would work: > namespace A; > class X {} > namespace B; > class Y {} This looks very messy. We should either go with curly braces or with one namespace at the top of a file. And even if we do multiple namespaces per file. I guess we do not allow a naespace to be spread onto several files, right? The current implementation is not clear at all. Since everything following a namespace declaration belongs into that declaration and since nothing is allowed ontop of that declaration I'd expect that the second namespace would actually create an inner naespace. Either way dealing with this without curly braces requires an IDE while today I still edit nearly all of my PHP with a simple text editor. And even when assuming everyone would use an IDE, the implementation of multiple braceless namespace is very tricky and more important hard to visualize and thus confusing for the user. marcus > This would not work: > class X {} > namespace A; > class Y {} > This would not work either: > require 'foo/bar.php'; > namespace A; > class X {} > This however would work: > namespace A; > require 'foo/bar.php'; > class X {} > namespace B; > class Y {} > So, for the people that wanted multiple NS per file, would such solution > work? > P.S. this is *not* a "should we use braces" thread, so please don't :) > -- > Stanislav Malyshev, Zend Software Architect > stas@zend.com http://www.zend.com/ > (408)253-8829 MSN: stas@zend.com Best regards, Marcus