Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126018 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 91F1B1A00BD for ; Thu, 21 Nov 2024 10:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732183679; bh=a+T3+7uYc8rQ+wCjRGYxaYjung3gz+DOZFkN0aFgrWY=; h=From:Subject:Date:References:To:In-Reply-To:From; b=joL6EPt5D+s337gCBL8qFwWRLui31lzSl10mH56p2PnC7Aq4S2onSGW7RDbmI0bz+ 1z37SgcbiiQToAmaVq7QlKLCXORCyXPZGcjWPB+5mCDfl168scfUbm6rKhw402sVxp 8W6RzFPO/1zT8pu/M4e9fbPerQPOaGkPVGu3reFQjd1W0rSpZ+oiNu1gzvHY6HudIb pR2KZZGh8TY2F5n/jT8IqVMpCdIwv3jT6snNfolsmStLuz1ykLpkowmPbNL0PIvJ4q Csw+M8XmcDzIYy5NvVYYbuNbYGM0ktqGLGUtMqlvmZYFQM8yHrckU2oDdlz1pQQT0U /Thz3f0/qQaHg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D7AF118006F for ; Thu, 21 Nov 2024 10:07:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail.gna.ch (mail.gna.ch [212.45.196.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 21 Nov 2024 10:07:57 +0000 (UTC) Received: from smtpclient.apple (unknown [IPv6:2a02:1210:2e0f:4100:a138:e222:6def:3d8a]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 34F183A0921 for ; Thu, 21 Nov 2024 11:05:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1732183515; bh=a+T3+7uYc8rQ+wCjRGYxaYjung3gz+DOZFkN0aFgrWY=; h=From:Subject:Date:References:To:In-Reply-To; b=mSbrri9iAltEw6YgQNIoauo6IdRXYNZ0fpssLzdpD+jm38Kuy0mt61GUPU1sT8iq6 1x4rC6mUlAXdFgwAy64gZa6cqZwxySdlri6sOXAYcanSW7a/SI6PVHg+as8c0fUul4 NouOlAzIL1lslRY/NqMQyDmq0A9zWJ76pRnWN6DU= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.200.121\)) Subject: Re: [PHP-DEV] [Discussion] Make objects unpackable by default Date: Thu, 21 Nov 2024 11:05:14 +0100 References: <3dcc5393-6ce7-465c-abe6-ecb687b0f369@app.fastmail.com> To: php internals In-Reply-To: Message-ID: X-Mailer: Apple Mail (2.3826.200.121) From: cschneid@cschneid.com (Christian Schneider) Am 14.11.2024 um 22:27 schrieb Gina P. Banyard : > Agreed, this bites us constantly when needing to reason about what an = "object" is in PHP. > Similar to array it mixes the concept of a struct, with that of a = reference value, and "overloading" various behaviours (e.g. iterators = and ArrayAccess). > It is *extremely* simple to go from foreach ($object as $prop) {} to = forearch(get_object_vars($object) as $prop) {} > and mandating this would resolve a lot of complexity, be that from the = perspective of what is "possible" or not to do, and from an engine PoV. Is there (currently) a difference between foreach ($obj ...) and foreach (get_object_vars($obj) ...)? If there is then the migration is not always "extremely" simple, no? If there isn't then we can simply define that from now on the former is = equivalent to the second one and ignore future changes to visibility, = hooks etc. My main point is that over the last years a lot of (for our code = unnecessary) complexity was added but I hardly complained because other = people have other needs. I just ask for similar consideration in return = when stripping stuff. Regards, - Chris