Hi Andrew,

在 2012年7月24日星期二,下午11:39,Andrew Faulds 写道:

> 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:
> >  
> > <?php
> > // 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
>  
>  

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
>  
> 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/
>  
>  


Reply via email to