Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54812 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48041 invoked from network); 23 Aug 2011 03:44:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Aug 2011 03:44:01 -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.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:56189] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/D1-34091-FF1235E4 for ; Mon, 22 Aug 2011 23:43:59 -0400 Received: by vwl1 with SMTP id 1so4959384vwl.29 for ; Mon, 22 Aug 2011 20:43:56 -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 :content-type:content-transfer-encoding; bh=uzqD8Yzou2B/Oz6IG1CG5inMt0tSKm6Od8oVgC83HHI=; b=AzLOOO2ZgU+WeNl+ZjnOBk7V77eVOdjJ0ZU/zndRSv6oQ91Yyf9VCGYUb+fka7zNjv DtjebTn0U1V01YAtranX3RAOoG/1fCikY5jP8bz2UsLq4m6jaLAfOLBTAV8yZU8TxMGc Vbu6o0Tw0Z2mO+b26y/3LpHU/2kKvPS9DcsWg= MIME-Version: 1.0 Received: by 10.52.185.197 with SMTP id fe5mr2956441vdc.6.1314071036391; Mon, 22 Aug 2011 20:43:56 -0700 (PDT) Received: by 10.220.38.193 with HTTP; Mon, 22 Aug 2011 20:43:56 -0700 (PDT) In-Reply-To: References: <4E145FE2.5000001@php.net> Date: Tue, 23 Aug 2011 11:43:56 +0800 Message-ID: To: 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: I found this feature was decided to do in PHP 5.3 TODO list : http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/TODO?revision=3D2429= 49&view=3Dmarkup so I was wondering does this previous decision still shoudl be think as valid? hehe thanks 2011/7/7 Xinchen Hui : > Hi: > > =C2=A0 thanks very much for this, that second patch is a wrong one, =C2= =A0updated .. > > 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 th= ough >> at first glance (apart from some CS *nits probably, like duplicate >> parenthesis and usage of if {} else { if {} else {}} instead of if {} el= seif >> {} 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 = you >>> confuse. >>> >>> =C2=A0the feature request is here: https://bugs.php.net/bug.php?id=3D10= 203 >>> >>> =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=A0= 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 =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 >>> >> >> > > > > -- > =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 > --=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