Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61739 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60135 invoked from network); 25 Jul 2012 06:55:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2012 06:55:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:53174] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/5B-27263-3489F005 for ; Wed, 25 Jul 2012 02:54:59 -0400 Received: by vcbgb30 with SMTP id gb30so337349vcb.29 for ; Tue, 24 Jul 2012 23:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=wVEkn7hCSUGMxnd2xcwcFZKKkmTkbDeZ4VHQ9KZC2jk=; b=Caps+wNyo3vZ5HYCEIYxUuY9qV71rbTDFwRqUoOy4hA9nVlzQzzltoOnbejveyMuc4 QvoSYg9Qo91K6dxU3pZQEymQPJdnRIt0/aUbhGuoa9xvFICtrcinBE44nRQdczq/m+s4 9lWH9cETJYdH1bpwTfJH5tL9H9HgQWpV5msnAvDeXO6ImtXBJQEwVCuQbNv9bhZBSXcc uPoEeaAZ2r5LFW9zUVz55PkGBXypBGsCqNvMo7nTlKDtaP+ggzRVUvCU9PnVnVK+nLuO rueSHdJxKkuNhYsZLtJ5ihGCtvXOWwqEAIDd0wlBhtKkqes/Sx9KBwxnyOKaAgYh8MJn te/Q== Received: by 10.52.155.193 with SMTP id vy1mr15129194vdb.123.1343199296086; Tue, 24 Jul 2012 23:54:56 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.195.3 with HTTP; Tue, 24 Jul 2012 23:54:35 -0700 (PDT) In-Reply-To: <4437FDA5E11542ECA9CAE622B6070F32@gmail.com> References: <933A547D13294D10A802336D74E42DFE@gmail.com> <500EEA67.8060100@sugarcrm.com> <76992170DA45492DAD9EFFEBC4F791B9@gmail.com> <500F82AB.30508@sugarcrm.com> <4437FDA5E11542ECA9CAE622B6070F32@gmail.com> Date: Wed, 25 Jul 2012 14:54:35 +0800 X-Google-Sender-Auth: lDYnf9-EmdLTFtrORlRIcgrDEJA Message-ID: To: Reeze Xia Cc: Stas Malyshev , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: =?UTF-8?B?UmU6IOWbnuWkje+8miBbUEhQLURFVl0gUmU6IOWbnuWkje+8miBbUEhQLURFVl0gW1JGQw==?= =?UTF-8?B?XSBQcm9wb3NhbCBuYW1lc3BhY2UgaW1wb3J0aW5nIHdpdGggZnJvbSBzeW50YXg=?= From: laruence@php.net (Laruence) On Wed, Jul 25, 2012 at 2:43 PM, Reeze Xia wrote: > Hi, > > =E5=9C=A8 2012=E5=B9=B47=E6=9C=8825=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89= =EF=BC=8C=E4=B8=8B=E5=8D=881:27=EF=BC=8CLaruence =E5=86=99=E9=81=93=EF=BC= =9A > > Hi: > > is there any really usage? I didn't see before. I don't think every > > Yes, eg: > https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Entity= Repository.php#L24 > > it could be: > from Doctrine\Common\Collections use ExpressionBuilder, Criteria, > ArrayCollection, ExpressionBuilder; > > The Motivation is that I found many projects that use namespace have the > problem of repeat type > the same namespace again and again. > > python feature is proper for PHP. PHP is not python. > > I think it could be useful to reduce duplication, but not copy everything > from Python. > like many useful features we borrowed from other languages ;-) > > > -1 on this RFC > > +1 for Stas > > and one more thing, BC break. > > Yes, introduce new features may break things, eg the new trait,insteadof = in > 5.4, and maybe > the comming finally, yield etc. but if it is desired, I think it may wort= h > it. yeah, I think it's not wroth. and the key word of mine is "there are many", but I didn't make it as a main argument. thanks > > Thanks for your feedback! > > > there are many ORM or DB warpper libraries defines `from` method, like: > > $db->select()->from(); > > thanks > > On Wed, Jul 25, 2012 at 1:22 PM, Stas Malyshev > wrote: > > Hi! > > No, we can not import namespace directly for now : > > > Of course you can. You just missing on what namespace import means in > PHP, it's not like Java (though a bit like Python). > > namespace A { > class B {} > } > > namespace { > use A; > > var_dump(new B()); > } > > > use A is a no-op, just as the warnings tell you. You can just write A\B. > It's only 2 characters more. If your A is longer, then you can alias it > to something shorter. > > and if we need alias we could=EF=BC=9A > // reduce > use GlobalNamespace\SubSpace\ThirdSpace\Class1; > use GlobalNamespace\SubSpace\ThirdSpace\Class2 as Alias2; > use GlobalNamespace\SubSpace\ThirdSpace\ForthSpace\Class3 as Alias3; > > > You could just do > use GlobalNamespace\SubSpace\ThirdSpace as Spc; > $a =3D new Spc\Class1(); > > Hi Stas, > That is what I am trying to propose, maybe it could be more DRY? > > thanks :) > > > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > Laruence Xinchen Hui > http://www.laruence.com/ > > --=20 Laruence Xinchen Hui http://www.laruence.com/