Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61693 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25697 invoked from network); 24 Jul 2012 15:48:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 15:48:12 -0000 Authentication-Results: pb1.pair.com header.from=reeze.xia@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: reeze.xia@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:62193] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/EC-17533-AB3CE005 for ; Tue, 24 Jul 2012 11:48:11 -0400 Received: by pbbrp12 with SMTP id rp12so13811133pbb.29 for ; Tue, 24 Jul 2012 08:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type; bh=KxuNssIYoLWd+3p6aaOzaXiYGvyde5JN7P3ebBEPGNk=; b=UNWESd4tfaU8lDqgrMcB2jOY/niIhP+XDIw4YIjtfQ1ylPBgFd8zu/N91hswq63jtn breUwwpL2v8ZtqI9gu1ddy+CAzCfDa/0gu3YiVP7FpHXziLOt3mTFu+6+NpWSBTckH66 rsPGxGFksqktDdXeagYpg44AbYCeV6l/UOg4MmHcOiEyc2PmlBgICnHasq3x9Z/5F1r1 ryYnq8kvL7QE0nh/U8bGdPNgo6zXoB9LKIwJnjiNangUwEZtjy8HO5qQxCbrx+PjBAXo 64sxbUAB/thG2ed8v87f2AePepdhZHCNSQTeF4IzvD8g9HH0mTFCAa/exoAIvRnhp1Ei gF6g== Received: by 10.68.203.66 with SMTP id ko2mr46092559pbc.84.1343144888422; Tue, 24 Jul 2012 08:48:08 -0700 (PDT) Received: from [192.168.0.106] ([118.186.207.230]) by mx.google.com with ESMTPS id ov8sm1188686pbb.2.2012.07.24.08.48.04 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 08:48:07 -0700 (PDT) Date: Tue, 24 Jul 2012 23:48:57 +0800 To: Andrew Faulds Cc: internals@lists.php.net Message-ID: <611EFA0D6C384549A0332BF2EE4CE658@gmail.com> In-Reply-To: <500EC19B.3040906@ajf.me> References: <933A547D13294D10A802336D74E42DFE@gmail.com> <500EC19B.3040906@ajf.me> X-Mailer: sparrow 1.6.3beta (build 1165) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="500ec3ea_1f404301_d5f9" Subject: =?utf-8?Q?=E5=9B=9E=E5=A4=8D=EF=BC=9A_?=[PHP-DEV] [RFC] Proposal namespace importing with from syntax From: reeze.xia@gmail.com (Reeze) --500ec3ea_1f404301_d5f9 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Andrew, =E5=9C=A8 2012=E5=B9=B47=E6=9C=8824=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=8C=EF= =BC=8C=E4=B8=8B=E5=8D=8811:39=EF=BC=8CAndrew =46aulds =E5=86=99=E9=81=93=EF= =BC=9A > 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 f= rom the same namespace. > > =20 > > I propose a new syntax to import classes=5Cfunctions=5Cconstant in a = single statement. > > =20 > > here is the example: > > =20 > > <=3Fphp > > // reduce > > use GlobalNamespace=5CSubSpace=5CThirdSpace=5CClass1; > > use GlobalNamespace=5CSubSpace=5CThirdSpace=5CClass2; > > use GlobalNamespace=5CSubSpace=5CThirdSpace=5C=46orthSpace=5CClass3; > > // to > > from GlobalNamespace=5CSubSpace=5CThirdSace use Class1, Class2 as Ali= as2, =46orthSpace=5CClass3 as Alias3; > > =3F> > > =20 > > The above code should be self-explained. > > =20 > > More info could be found at the R=46C page and the patch. > > =20 > > R=46C: https://wiki.php.net/rfc/namespace-importing-with-from > > PATCH : https://github.com/reeze/php-src/compare/rfc-from-use > > =20 > > Any Opinion, suggestion, improvement will be much appreciated. > > =20 > > Thanks > Ah, so something a la python's from x import y, z=3F Sounds good. Somew= hat =20 > surprised we don't already have this. > =20 > One comment: =22use Class1, Class2 as Alias2, ... ;=22 confuses me a bi= t. I =20 > read it as =22use (Class1, Class2) as Alias2, ... ;=22. //Perhaps this = is > =20 > =20 It means use Class1 **and** use Class2 but aliased with name Alias2 etc. It almost the same as bare 'use' statement, but with a common prefix :) Thanks > =20 > just a formatting issue (with newlines it would be more clear), but it = =20 > looks a little weird to me. > =20 > Just my 2=C2=A2. > =20 > -- =20 > Andrew =46aulds > http://ajf.me/ > =20 > =20 --500ec3ea_1f404301_d5f9--