Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33947 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42111 invoked by uid 1010); 11 Dec 2007 23:46:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42089 invoked from network); 11 Dec 2007 23:46:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2007 23:46:07 -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.162.233 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.162.233 nz-out-0506.google.com Received: from [64.233.162.233] ([64.233.162.233:45874] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/80-38526-D312F574 for ; Tue, 11 Dec 2007 18:46:06 -0500 Received: by nz-out-0506.google.com with SMTP id x7so5291nzc.38 for ; Tue, 11 Dec 2007 15:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; 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; bh=Mc/b5tLwlzWbpcWWyQHdZ2kRA9e/QJXQ9VhfAARRSRI=; b=RB799pBl3+L9spIsbw6fQpHPTSx8v6OdJ7LVvY4OGLnDNnLhCeK5HhEacLTa7kO+v0ZL3Ie7yC8zgnTqRS/mjcntsyk+HlPOxUyzP1Zdijm82nj4mvMK84RrOsYeDVvzQy4nh2SD+dbuF5A8HKNVrYspJmeIjuO7g3W5eR0CYtI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=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=d19fE6QHPetan/905t6dZIHadmfzaRwggNhPUMh1GrGG/sYWJEamY7AiJzbLImcrMM9Nm5Hcw1DrvQxmY/azWriKnr8KJlH5shEcp7ZTU8muF4ErDKY2+6k5o119Udgv6195L1CR1Blvrh/IPDN12JzmNnMD7aG3X0nA2Ke2lZA= Received: by 10.142.48.14 with SMTP id v14mr50635wfv.1197416728696; Tue, 11 Dec 2007 15:45:28 -0800 (PST) Received: by 10.143.49.3 with HTTP; Tue, 11 Dec 2007 15:45:28 -0800 (PST) Message-ID: Date: Tue, 11 Dec 2007 18:45:28 -0500 Sender: david.coallier@gmail.com To: "Gregory Beaver" Cc: "internals Mailing List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <475F1984.603@chiaraquartet.net> X-Google-Sender-Auth: a73be15351d633b2 Subject: Re: [PHP-DEV] namespace improvements to be committed very soon - final review From: davidc@php.net ("David Coallier") On Dec 11, 2007 6:42 PM, 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 > Wow even nested namespaces are implemented!!! namespace name; { { { class Test { } } } } ....... use name as superName; var_dump(new superName::Test()); Come on... -- David Coallier, Founder & Software Architect, Agora Production (http://agoraproduction.com) 51.42.06.70.18