Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31746 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83293 invoked by uid 1010); 20 Aug 2007 20:06:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83275 invoked from network); 20 Aug 2007 20:06:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2007 20:06:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.coallier@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.coallier@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.184.229 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: david.coallier@gmail.com X-Host-Fingerprint: 64.233.184.229 wr-out-0506.google.com Linux 2.4/2.6 Received: from [64.233.184.229] ([64.233.184.229:33098] helo=wr-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/71-06760-644F9C64 for ; Mon, 20 Aug 2007 16:06:33 -0400 Received: by wr-out-0506.google.com with SMTP id 58so1104251wri for ; Mon, 20 Aug 2007 13:06:25 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=mVEapVUj4xthcd9nLZS7iSkRlnNKmvFU/AeUqn8Ur2wK8MP0xxMkraKTSCDH/T3EQdDvJ0kAvITlFCwuXVjx4IZJe2fV93BYe4uIClEZ54vD2PgjG9AIrZ58GvB0RoKNsP4EZgIAADBHumapNZQvXz04kC282IW0dBfYRbv0qig= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=V2ecFrmiVVhuLWyM/iz1on2zHTg9i4SYh6SiVAlyQYXhgfno4nBJLg4VxNLOaMELmPeHAyX9woeNjhGiRgAM1b3y1+NVXgafkmzVeJ1rNKrINmkLiIx0/fpNmq3NOEMsCc4+w+C8wgAxkq7fs50UR+lgPaCxcrOMCAvrQc8VavM= Received: by 10.90.119.15 with SMTP id r15mr10736700agc.1187640384925; Mon, 20 Aug 2007 13:06:24 -0700 (PDT) Received: by 10.90.96.12 with HTTP; Mon, 20 Aug 2007 13:06:24 -0700 (PDT) Message-ID: Date: Mon, 20 Aug 2007 16:06:24 -0400 Sender: david.coallier@gmail.com To: "Gregory Beaver" Cc: "internals Mailing List" , "Dmitry Stogov" , "Stanislav Malyshev" In-Reply-To: <46C9F217.8040804@chiaraquartet.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46C9F217.8040804@chiaraquartet.net> X-Google-Sender-Auth: 7f0f7e144bf55e4b Subject: Re: [PHP-DEV] [PATCH] allowing multiple namespaces per file plus namespaces with brackets From: david.coallier@nyphp.com Thanks. someone please commit that as fast as posible so no one can say anything ;-) On 8/20/07, Gregory Beaver wrote: > Hi all, > > This patch is also available at > http://pear.php.net/~greg/namespace.patch.txt > > The patch adds the syntax "namespace { *stuff }" and allows multiple > namespaces per file with no performance penalty or added complexity as > only 4 lines of code need to be changed, and 9 lines of code added to > implement this support! > > Basically, there is one use case of multiple namespaces per file that > the patch is designed to support, which is the ability to cram many > files into a single file. I have done this for purposes of distributing > things (prior to phar), it is used by some with phing tasks for > performance reasons, and can have other uses as well. > > The patch provides the ability to do this, for example: > > namespace One { > require_once 'blah.php'; > class MyClass extends blah > { > function test() > { > echo "OK\n"; > } > } > function test() > { > echo "OK\n"; > } > } > > namespace Two { > class MyClass > { > function test() > { > echo "OK\n"; > } > } > function test() > { > echo "OK\n"; > } > } > ?> > > Note that the old format "namespace OneRingToRuleThemAll;" is still > fully supported, and should be the recommended format, as build tools > can easily take an entire file, change namespace .*; into namespace .*{ > and append to the end of the file. > > The attached patch is against php6, but as you can see, a blind monkey > could port it to PHP_5_3 when the time comes. All of the introduced > changes are now tested, including the error message for nested namespace > declarations, and the error message for multiple namespace declarations > with ; (which was previously untested by .phpt tests) > > Thanks, > Greg > -- David Coallier, Founder & Software Architect, Agora Production (http://agoraproduction.com) 51.42.06.70.18