Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61692 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21625 invoked from network); 24 Jul 2012 15:39:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 15:39:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 64.22.89.133 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 64.22.89.133 oxmail.registrar-servers.com Linux 2.6 Received: from [64.22.89.133] ([64.22.89.133:46627] helo=oxmail.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/FB-17533-2B1CE005 for ; Tue, 24 Jul 2012 11:39:31 -0400 Received: from [192.168.0.200] (5ad32874.bb.sky.com [90.211.40.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 0AEF9C3007B for ; Tue, 24 Jul 2012 11:39:27 -0400 (EDT) Message-ID: <500EC19B.3040906@ajf.me> Date: Tue, 24 Jul 2012 16:39:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: internals@lists.php.net References: <933A547D13294D10A802336D74E42DFE@gmail.com> In-Reply-To: <933A547D13294D10A802336D74E42DFE@gmail.com> Content-Type: multipart/alternative; boundary="------------070605000008070701040508" Subject: Re: [PHP-DEV] [RFC] Proposal namespace importing with from syntax From: ajf@ajf.me (Andrew Faulds) --------------070605000008070701040508 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 24/07/12 16:35, Reeze wrote: > Hi, internals, > I'm proposing a improvement to namespace importing. when using 'use' statement to import > many classes, we have to duplicate many times even we are importing from the same namespace. > > I propose a new syntax to import classes\functions\constant in a single statement. > > here is the example: > > // reduce > use GlobalNamespace\SubSpace\ThirdSpace\Class1; > use GlobalNamespace\SubSpace\ThirdSpace\Class2; > use GlobalNamespace\SubSpace\ThirdSpace\ForthSpace\Class3; > // to > from GlobalNamespace\SubSpace\ThirdSace use Class1, Class2 as Alias2, ForthSpace\Class3 as Alias3; > ?> > > The above code should be self-explained. > > More info could be found at the RFC page and the patch. > > RFC: https://wiki.php.net/rfc/namespace-importing-with-from > PATCH : https://github.com/reeze/php-src/compare/rfc-from-use > > Any Opinion, suggestion, improvement will be much appreciated. > > Thanks > Ah, so something a la python's from x import y, z? Sounds good. Somewhat surprised we don't already have this. One comment: "use Class1, Class2 as Alias2, ... ;" confuses me a bit. I read it as "use (Class1, Class2) as Alias2, ... ;". //Perhaps this is just a formatting issue (with newlines it would be more clear), but it looks a little weird to me. Just my 2ยข. -- Andrew Faulds http://ajf.me/ --------------070605000008070701040508--