Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104208 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48853 invoked from network); 5 Feb 2019 22:05:36 -0000 Received: from unknown (HELO mail-it1-f181.google.com) (209.85.166.181) by pb1.pair.com with SMTP; 5 Feb 2019 22:05:36 -0000 Received: by mail-it1-f181.google.com with SMTP id z20so11860itc.3 for ; Tue, 05 Feb 2019 10:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jDXhZ0blfylsB4zseN97bk8IW7Zis+vL4WBnNOU4H0A=; b=gLOH+TvZQIVLqB1zJFZXxbeVCFfVQsys/r15ShRmqb7LnE/BT6B2BICqCbhUWhjBGF ara1wrggKO3+McVWk22KqLQrCW/6hFyM14EVUgRLWAndK8mGvXK7BRR3RrcnPHfO19tc pAt0qWR76arPXu4GybZbNcm1m0n59L5u8WojQnrpdp8KevDpy7U7ng+GJvM64mMJaTce ztm3LZSI/1PB6y8qGgWMyjLyFw1ZVoCsUXw4zN/RhWe2LpVrcU44OgrWmFojvk6YgYUH zl7imyN1D5Ur1KahOZs3rNYsr3BFAwPWprDjOp6jZrXtVxVPiotEq6j9m+KmeQ9QOU3/ dvFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jDXhZ0blfylsB4zseN97bk8IW7Zis+vL4WBnNOU4H0A=; b=l3TT0eEVk7Bw7xQM9lLtZpJmsjea0JKpqxW441SwQa9pncJ64kSc1sKCaxyZf6WcXN h1KPVa/nvEDnpUhnj6V522/3vlsbL45gjCqRAW67BAi66Cyqx7GBoNr6AY58/tII1k0U zJI8U/B57dIk7PUjGApx16VZwsEXHtyqXCBxl86qxUyMVmmtKdx/8N2ntQxFRUKltXDr ozzT8VgX0CgN9Xa6A/NYIbAEjLBZ/0Tgv4kE3v7TsKK6jvjj99yvXyN83qNCZuXm0P1Y 3NWe/ub91GqkT841vjA1syByM4xI5q5O4vSKhgDsL8kx3yVK4+DgqE4vagK3uCIpxPNj yCew== X-Gm-Message-State: AHQUAuaT4ElRWwV+19CK2IE9KF1aGNwVWGVPNM7SbPrbneVc9CM17Ln5 bnKsPv47kwtlvQ8lTGY7j55vrjSN/KlK70cjtdQOnZ97 X-Google-Smtp-Source: AHgI3IbdvUc35Yi5lhTsAqlJjXyIn+4ImVl3arVLUcVgUuw5UhbZ1KDaf6EMSA6vhTNkLt1Wvi6KWPZfI7eHaK+uTuc= X-Received: by 2002:a24:32c5:: with SMTP id j188mr60075ita.139.1549392408187; Tue, 05 Feb 2019 10:46:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 5 Feb 2019 18:46:37 +0000 Message-ID: To: Craig Duncan Cc: Internals Content-Type: multipart/alternative; boundary="0000000000001b9a5a05812a083e" Subject: Re: [PHP-DEV] [VOTE] Making stdClass iterable From: rowan.collins@gmail.com (Rowan Collins) --0000000000001b9a5a05812a083e Content-Type: text/plain; charset="UTF-8" On Tue, 5 Feb 2019 at 17:25, Craig Duncan wrote: > The *iterable* type accepts a plain array, but not an object that is used > to represent a plain array, that's surprising to me. > I think this notion of stdClass as "an object used to represent a plain array" is a peculiar one. The only reason I can think of for using stdClass is to specifically *not* be like an array in some way. As I mentioned in the discussion thread, the closer comparison would be to an anonymous class: $foo = new stdClass; and $foo = new class {}; both produce objects with no behaviour, no pre-defined methods, and the ability to define properties dynamically. On that definition, there's no surprise at all: it's an object that has no defined behaviour, so is not defined as having the "iterable" behaviour. > To me, this class is presented as a first class citizen, but it works like > a second class one. > While I agree that it's an anomaly in many ways, I think the fact that it's not marked iterable is a peculiar detail to get stuck on. Regards, -- Rowan Collins [IMSoP] --0000000000001b9a5a05812a083e--