Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80950 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46578 invoked from network); 22 Jan 2015 04:55:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jan 2015 04:55:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.47 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.47 mail-qa0-f47.google.com Received: from [209.85.216.47] ([209.85.216.47:33286] helo=mail-qa0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/10-44026-DA280C45 for ; Wed, 21 Jan 2015 23:55:10 -0500 Received: by mail-qa0-f47.google.com with SMTP id n8so36324820qaq.6 for ; Wed, 21 Jan 2015 20:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=7LZ6RhPYdW+aJX9KxffhtdPy9PxjxJWYjm6jygJ151A=; b=uS7b4lGLSf5RWInEjs/Im+D79058is6iVo3qlrEa9xjtxLPOBBSlfmUV3pld4Gn9k6 O3U7jJUCx6ntvIegXJw3ZLIG+DQZCf207xFH/7dDDdpX4rxI/m+q9xxMrDzoQyO6gKLy 6BTzBN83xfSkg30l8+I3OdpWfLsnZtDwv9AoAe8Dy9W26C+zpOGHzHKXFkNTXEIekNxk BEqHr4TQRn8afXBSQnah3AHk8bAgPC2MAa+4KpFpIckmn4PfOKS1fqSLGzaH4fctDHcg o5rCxvoRFVnoaO+PYvmn28sl5AjDxxRpmoOwCGSvCYFQoQ2XIKU4O8Wbstma+Seeiz3o 87WQ== X-Received: by 10.224.111.194 with SMTP id t2mr46533305qap.86.1421902507372; Wed, 21 Jan 2015 20:55:07 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.93.70 with HTTP; Wed, 21 Jan 2015 20:54:27 -0800 (PST) In-Reply-To: References: <54B93AAD.6080308@gmail.com> Date: Thu, 22 Jan 2015 13:54:27 +0900 X-Google-Sender-Auth: EhPOK-0qFC5utoryBAl_3WLbcDg Message-ID: To: Nikita Popov Cc: Dmitry Stogov , Rowan Collins , "internals@lists.php.net" , Xinchen Hui Content-Type: multipart/alternative; boundary=047d7b604582db79d0050d3679cc Subject: Re: [PHP-DEV] Fixing strange foreach behavior. From: yohgaki@ohgaki.net (Yasuo Ohgaki) --047d7b604582db79d0050d3679cc Content-Type: text/plain; charset=UTF-8 Hi Nikita, On Thu, Jan 22, 2015 at 12:42 AM, Nikita Popov wrote: > On Wed, Jan 21, 2015 at 2:57 PM, Dmitry Stogov wrote: > >> Hi, >> >> Yeah, I think changing foreach behaviour in more consistent and efficient >> way may make sense. >> If we won't use HashTable.nInternalPointer we won't need to copy >> immutable arrays. >> The same for nested foreach on the same array. >> We could also eliminate all the HashPosition magic introduced to keep >> PHP5 behavior. >> >> On the other hand some apps may relay on current weird behavior. >> >> I remember, long time ago Nikita made some related proposal. >> Nikita, could you please send a link. >> >> Thanks. Dmitry. >> > > Original proposal is the patch linked at the end of > https://bugs.php.net/bug.php?id=53405. However that was aimed at making > external HashPosition iteration to work like the internal pointer, so we > could make it fully independent while keeping most of the current behavior. > I fear it would make the implementation even more complicated than it > already is. > > For PHP 7 we have the option to alter the iteration semantics for edge > cases a bit (especially interaction of iteration and changes to the array). > I'll have to try out some ideas in that direction and report back. > Great to hear this. I'm looking forward outcomes! Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --047d7b604582db79d0050d3679cc--