On Wed, Jul 25, 2012 at 2:43 PM, Reeze Xia <reeze....@gmail.com> wrote:
> Hi,
>
> 在 2012年7月25日星期三,下午1:27,Laruence 写道:
>
> 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/EntityRepository.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 worth
> 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 <smalys...@sugarcrm.com>
> 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).
>
> <?php
> 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:
> <?php
> // 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 = 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/
>
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to