Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94340 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91767 invoked from network); 30 Jun 2016 20:02:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jun 2016 20:02:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=jmikola@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jmikola@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: jmikola@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lf0-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:36544] helo=mail-lf0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/06-14264-9BA75775 for ; Thu, 30 Jun 2016 16:02:01 -0400 Received: by mail-lf0-f42.google.com with SMTP id q132so63110927lfe.3 for ; Thu, 30 Jun 2016 13:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BSQmXffgXsuEZOCQDAGapSKOEO0XHBuGFITEOuBq04s=; b=zPR5TSVPMkQJaPifYxNH4ZUESHBS6jI1FCk4otxrR+IqjcPFJl0cygLE6lxCSqqksQ cekexqm6kzpfef68Bzxogr3KJutIe6i2H7ldkrdqy87YZg1jacDbtSaTM7FupnKVVUcK ZmVwIOTFkv1iZa3mJ/4PujOVGGbuvo5bIX7Uqnkif3lzp7S864OFsvLV4E9f80f59pxL 6/qZLLb7lyWjxUzU1SVe8HtXeKVVtbyxpgxDCWZahlBNIsNUGpofAeTINtcxoYhCpcIf BymRLzq/oOHA92Xnc7ijU3QMx54Hhhj1XQZLKCdmvUTcJ5zoN6riFO7eNSyCNb74W7Gs 1PKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BSQmXffgXsuEZOCQDAGapSKOEO0XHBuGFITEOuBq04s=; b=SxUTury94G8SSjHJq1V92M5siFAcIaUbV2wRhzSMV17mT2jHCq44d3IBry8VFfgu13 LhBoegcOqoz+eERpYWd62HWnX4wgLX6ei8OQRBGwHrmJZaCzUQX/bSumTfazsLt51xX3 Gq66PUE5bep64WcZDHPGHDAVGaXqYyjZJX5EeeYX+AMUtxoiN/UYeQXDQlwSFffDYhbh sm65mVTDPfXYoqUKUl43AF4QS/mViIQAgiswQxjwsYN7fTmeOCLCXuHLzze0/7XlYp6t qZ60eEbb0bnH1kpPSsUKjVN3qE1dZkLmOL0aoNXzkX6w1EsAIcSYUPDnxUGLGLL+rPI7 yZSw== X-Gm-Message-State: ALyK8tJ5OLrivnoabUbq4vRdfoe9GgjbZJL8zLzRItX6bzivEkrXeQtYo8r0KXxiELvFuGbL7fJ1qgRI5jI2Tw== X-Received: by 10.46.71.3 with SMTP id u3mr4910883lja.67.1467316918228; Thu, 30 Jun 2016 13:01:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.87.5 with HTTP; Thu, 30 Jun 2016 13:01:38 -0700 (PDT) In-Reply-To: <35132CB5-6E11-477F-8AC6-4374A7434D43@trowski.com> References: <8284FE1F-70EE-4DB6-A945-0C57A4C99DCC@trowski.com> <16ef864f-8378-1af3-ddfb-21dc583a4b4a@gmx.de> <35132CB5-6E11-477F-8AC6-4374A7434D43@trowski.com> Date: Thu, 30 Jun 2016 16:01:38 -0400 Message-ID: To: Aaron Piotrowski Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11411c0eaf1c1e05368457ba Subject: Re: [PHP-DEV] [RFC] Iterable From: jmikola@gmail.com (Jeremy Mikola) --001a11411c0eaf1c1e05368457ba Content-Type: text/plain; charset=UTF-8 On Sat, Jun 18, 2016 at 11:34 AM, Aaron Piotrowski wrote: > > I plan on bringing the iterable RFC (https://wiki.php.net/rfc/iterable) > to a vote in about a week, does anyone have any further feedback on this > proposal? > Was there any discussion about a special allowance being made for stdClass? I've noted the is_iterable(new stdClass) example and ensuing "Object Iteration" section: PHP allows any object to be used with foreach. However, iterable does not > accept any object, only those implementing Traversable. Values accepted > by iterable should be designed for iteration, not any set of values (such > as the public properties of an object or a string). > I'm on the fence if that second sentence applies to stdClass. Based on how users typically end up with stdClass instances (e.g. casting arrays to an object, json_decode()), I tend to think of them as logically equivalent to associative arrays. To that end, I'd consider stdClass to be as "designed for iteration" as any associative array -- if we can even say a stdClass was designed at all :) As-is, the RFC requires users to either cast stdClass instances to an array or decorate them with an Iterator (e.g. ArrayObject). I find this a bit irksome, but it's certainly easy to work around. That said, I realize that voting is in progress and it's not my intention to interrupt anything. I just wanted to relay a viewpoint that might not have come up. -- jeremy mikola --001a11411c0eaf1c1e05368457ba--