+1 for adding this.

I don't know enough C to review the patches. The first one looks fine though
at first glance (apart from some CS *nits probably, like duplicate
parenthesis and usage of if {} else { if {} else {}} instead of if {} elseif
{} else {}).

Your second patch (the one for adding the silence operator) though seems
strange. For example you are calling zend_do_begin_silence regardless of
whether '@' was used, don't you?


On Wed, Jul 6, 2011 at 3:33 PM, Xinchen Hui <larue...@gmail.com> wrote:

> Hi:
>
>  first of all, I am a guy whose english is poor, sorry for making you
> confuse.
>
>  the feature request is here: https://bugs.php.net/bug.php?id=10203
>
>  and I think this can make php code more flexible, and more making sense.
>
>  example:
>
>  foreach (array(
>       array(3, array(1, 2)),
>       array(7, array(3, 4)),
>      ) as list($sum, list($op1, $op2))) {
>        printf("%d + %d  = %d\n", $op1, $op2, $sum);
>  }
>
>  output:
>  1 + 2  = 3
>  3 + 4  = 7
>
>  plz read the RFC for more details.
>
> thanks
>
> 2011/7/6 Stefan Neufeind <neufe...@php.net>:
> > Hi,
> >
> > On 07/06/2011 03:06 PM, Hannes Magnusson wrote:
> >> 2011/7/6 Xinchen Hui <larue...@gmail.com>:
> >>>
> >>>   T_LIST is not allowed to used with foreach before.
> >>>
> >>>   and then there comes a freature request:  #10203  allow
> >>> foreach($array as list($a,$b)
> >>
> >> Ironically enough you managed to miss the last closing ), enforcing
> >> the point of this not being a natural syntax.
> >>
> >> Furthermore, without reading the RFC, is this the same as
> >> foreach($array as $a => $b) {}
> >
> > No, there $a would be the key. Intention would be, as I read the RFC,
> > that this could be an arbitrary list.
> >
> >> or
> >> foreach($array as $e) {
> >> list($a, $b) = $e;
> >> }
> >
> > Yes, I understood if like that. Just a short notation.
> >
> >> or.. ?
> >>
> >> that really doesn't look like something PHP should support imo.
> >
> > Don't see too many bad things about the idea ...
> >
> >
> > Regards,
> >  Stefan
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> 惠新宸        laruence
> Senior PHP Engineer
> http://www.laruence.com
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to