Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65549 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99117 invoked from network); 1 Feb 2013 02:31:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2013 02:31:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.53 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.219.53 mail-oa0-f53.google.com Received: from [209.85.219.53] ([209.85.219.53:57931] helo=mail-oa0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/80-24912-8F82B015 for ; Thu, 31 Jan 2013 21:31:21 -0500 Received: by mail-oa0-f53.google.com with SMTP id m1so2849075oag.26 for ; Thu, 31 Jan 2013 18:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=2zjCbROIaeYAbp/dKg8TfRbQfNzplYpB1YbQO9aOk0c=; b=HJBJhpfBhZG5G3zbCBHfCzD7QHY0qAuVIBGPsc4x1j33Hdy9GD0SRQiV3+92Wi9qtb v65qH4HtMQ1xf24h1x08WYeCFSOn6fXsBdrV8y/cYZr9scEw0miefEOB9RV6q0Fz7YLL H0KiO57JMxlRqUGZQmTG5A1wQxjHByu6yODzy0imIGAOlOrAETGq9xJh/6LgVcI20Nf+ Be/U2Z5ECLTuFLbnvbS+cL0luuqnA7QdboOFWhqkk3LQx3t/CR/zvt4twWcpZeZ/FIz3 CIRvYHFeUvJNrSQ1Hm4y5lyvTXI7nDV5GVZiVN4RloAdkowcAiSU+cyA/6Wg6k+LleGm 8OiA== MIME-Version: 1.0 X-Received: by 10.60.1.168 with SMTP id 8mr8311488oen.46.1359685877985; Thu, 31 Jan 2013 18:31:17 -0800 (PST) Received: by 10.76.96.236 with HTTP; Thu, 31 Jan 2013 18:31:17 -0800 (PST) In-Reply-To: References: Date: Thu, 31 Jan 2013 19:31:17 -0700 Message-ID: To: Rasmus Schultz Cc: Etienne Kneuss , Anthony Ferrara , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] rfc:foreach-non-scalar-keys From: morrison.levi@gmail.com (Levi Morrison) > I'm not sure how I came to that conclusion - did the description change > since I looked at it? Maybe a little bit but not very much, if at all. > I guess the title "foreach-non-scalar-keys" may have thrown me off - so > this isn't about arrays, or really even about foreach, but about the > Iterator interface. I'm not against that at all. Actually, this is ENTIRELY about foreach. You can currently return an object as a key from an iterator with no problems if you call the method. The problem is that the foreach code takes that value and coerces it to a string or integer. In the case of objects and arrays as keys it fails. We want the foreach to leave it alone and simply allow us to expose the key as an object or array. > I would suggest considering the addition of a second, distinct interface - > rather than a modification to the existing interface, which already does > what it's supposed to and works well, including the warning, which is > appropriate for the intended use of that interface with the foreach > statement. Having multiple interfaces that the engine uses to iterate in a foreach sounds like a bad idea to me. It's complicated enough as it currently is.