Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53773 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25390 invoked from network); 7 Jul 2011 15:50:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jul 2011 15:50:40 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; 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-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:47484] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/25-26983-FC5D51E4 for ; Thu, 07 Jul 2011 11:50:40 -0400 Received: by vxi39 with SMTP id 39so874074vxi.29 for ; Thu, 07 Jul 2011 08:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=NAAFZN/jUH5zepjKmGgrJx+U8L5JlpzYFJ8/Z3okYwk=; b=NF0IOwC4YyznSyupRoO+TrP8L1Xqrb/6Xr2lY2Ud+B6DXPXCWiTWjZrLA24jSK49QQ cVhCnRjC4cHSFZ+IQhr+21sOCMVjU9Uy39P4mXU0/sDFyM4GEVvBeVIrgidqrTJRMl9l EdtwVxLtgeLr3QY0S/DweWWoZIKyK/VXQHx9w= MIME-Version: 1.0 Received: by 10.52.157.136 with SMTP id wm8mr1336753vdb.28.1310053835773; Thu, 07 Jul 2011 08:50:35 -0700 (PDT) Received: by 10.220.95.5 with HTTP; Thu, 7 Jul 2011 08:50:35 -0700 (PDT) In-Reply-To: References: <4E145FE2.5000001@php.net> Date: Thu, 7 Jul 2011 23:50:35 +0800 Message-ID: To: Nikita Popov Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] foreach_variable supporting T_LIST token From: laruence@gmail.com (Xinchen Hui) Hi: thanks very much for this, that second patch is a wrong one, updated .. thanks 2011/7/7 Nikita Popov : > +1 for adding this. > > I don't know enough C to review the patches. The first one looks fine tho= ugh > at first glance (apart from some CS *nits probably, like duplicate > parenthesis and usage of if {} else { if {} else {}} instead of if {} els= eif > {} 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 wrote: >> >> Hi: >> >> =C2=A0first of all, I am a guy whose english is poor, sorry for making y= ou >> confuse. >> >> =C2=A0the feature request is here: https://bugs.php.net/bug.php?id=3D102= 03 >> >> =C2=A0and I think this can make php code more flexible, and more making = sense. >> >> =C2=A0example: >> >> =C2=A0foreach (array( >> =C2=A0 =C2=A0 =C2=A0 array(3, array(1, 2)), >> =C2=A0 =C2=A0 =C2=A0 array(7, array(3, 4)), >> =C2=A0 =C2=A0 =C2=A0) as list($sum, list($op1, $op2))) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("%d + %d =C2=A0=3D %d\n", $op1, $op2, = $sum); >> =C2=A0} >> >> =C2=A0output: >> =C2=A01 + 2 =C2=A0=3D 3 >> =C2=A03 + 4 =C2=A0=3D 7 >> >> =C2=A0plz read the RFC for more details. >> >> thanks >> >> 2011/7/6 Stefan Neufeind : >> > Hi, >> > >> > On 07/06/2011 03:06 PM, Hannes Magnusson wrote: >> >> 2011/7/6 Xinchen Hui : >> >>> >> >>> =C2=A0 T_LIST is not allowed to used with foreach before. >> >>> >> >>> =C2=A0 and then there comes a freature request: =C2=A0#10203 =C2=A0a= llow >> >>> 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 =3D> $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) =3D $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, >> > =C2=A0Stefan >> > >> > -- >> > PHP Internals - PHP Runtime Development Mailing List >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> >> >> >> -- >> =E6=83=A0=E6=96=B0=E5=AE=B8=C2=A0 =C2=A0 =C2=A0 =C2=A0 laruence >> Senior PHP Engineer >> http://www.laruence.com >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > --=20 =E6=83=A0=E6=96=B0=E5=AE=B8=C2=A0 =C2=A0 =C2=A0 =C2=A0 laruence Senior PHP Engineer http://www.laruence.com