Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33956 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86494 invoked by uid 1010); 12 Dec 2007 02:06:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 86479 invoked from network); 12 Dec 2007 02:06:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2007 02:06:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:59444] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/17-38526-8124F574 for ; Tue, 11 Dec 2007 21:06:17 -0500 Received: from [216.15.51.211] (port=50898 helo=[192.168.1.96]) by scottsdale.servershost.net with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.68) (envelope-from ) id 1J2GzI-0002NA-Fp; Tue, 11 Dec 2007 20:06:16 -0600 To: David Coallier Cc: Gregory Beaver , internals Mailing List In-Reply-To: References: <475F1984.603@chiaraquartet.net> Content-Type: text/plain Date: Tue, 11 Dec 2007 21:06:21 -0500 Message-ID: <1197425181.13494.0.camel@sams-room> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] namespace improvements to be committed very soon - final review From: sam@sambarrow.com (Sam Barrow) Is this patch going to be implemented in the PHP release? On Tue, 2007-12-11 at 18:42 -0500, David Coallier wrote: > On Dec 11, 2007 6:13 PM, Gregory Beaver wrote: > > Hi, > > > > I've been furiously working behind the scenes with Stas and Dmitry, and > > have some enhancements to namespaces in the form of 2 patches. > > > > 1) multiple namespaces per file > > 2) use ::name; > > > > 1) multiple namespaces per file > > > > This is implemented as such: > > > > > namespace one; > > use Blah::A; > > // code > > namespace two; > > use Foo::A; > > ?> > > > > The example above shows that imported names are reset at each namespace > > declaration. There is no prohibition on this code: > > > > > namespace one; { > > use Blah::A; > > // code > > } > > namespace two; { > > use Foo::A; > > // code > > } > > ?> > > > > namespace name; { > ... > } > ??? You can already do that... it's just adding random { } > > > > Users who wish to use brackets may do so. The performance penalty > > imposed by using brackets is minor for some cases, and for users who are > > following the recommended practice of 1 namespace per file, the syntax > > is ideal. > > > > Patch is: > > > > http://pear.php.net/~greg/namespace/PHP_5_3/multi.patch.txt > > http://pear.php.net/~greg/namespace/PHP_6_0/multi.patch.txt > > > > Note that non-namespaced code cannot be present in a file containing > > namespaces. For users who are bundling, this will mean you will need to > > create 2 files, one with non-namespaced code, and one with namespaced > > code. This minor prohibition is a design decision, not a technical > > problem in the implementation. > > > > 2) use ::name > > > > This code: > > > > > namespace Whatever; > > use MDB2; // import PEAR's ::MDB2 from global scope > > $a = MDB2::connect(); > > ?> > > > > is currently impossible, which will make namespacing old code harder. > > The patch introduces this new syntax to import names from the global > > namespace: > > > > > use ::MDB2, ::strlen as len; > > ?> > > > > http://pear.php.net/~greg/namespace/PHP_5_3/use.patch.txt > > http://pear.php.net/~greg/namespace/PHP_6_0/use.patch.txt > > > > These patches are for review of both serious technical and serious > > implementation issues. In order to help move things along, I'd like to > > define "serious" as something directly related to the implementation > > that would cause a failure in PHP's ability to run scripts > > deterministically, or some kind of memory leak/crash. > > > > commit is planned for the next 24 hours or so, but of course any issues > > found in review can be fixed. The patches are short, so in the worst > > case, reverting is not difficult. > > > > Thanks, > > Greg > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > David Coallier, > Founder & Software Architect, > Agora Production (http://agoraproduction.com) > 51.42.06.70.18 >