Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127567 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 lists.php.net (Postfix) with ESMTPS id B8DC41A00BC for ; Tue, 3 Jun 2025 17:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748970125; bh=HiDJoWCv7S2pAJVCLASokvKLTv4SY/JLDnZ5CYDYzGQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=kVE1NwPDVYJEAy4OsNojsIsXQMYnf92MyaYRI2PqQY2eBrYXjN9vcstwwQ8YH0V0L ik/mZw5nSySa4rzt9IkKkZjKnNmpYj6a307wghtfp/Sf6z2DG6Ou7rPZWAYl4jgyVd Sncsp51kmazahSZ7bkQe/4hfO39H19e3KW62OBEmmodr39GPuhf1xU/yfquUXBTEtP 2S/S/Ez7ynDgytKR64r4cKkVZOVxohcf8Dfcnbu+r3cBbk694vlrTw0sLYv5pO/DZK KVK/d9XszdRXzQwH4ZdhV6Y7sDuxTMB105OVxDWrbNyyMmbrpOymXvICewdbf0omhz VS5hrH1z9I8xg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E5DE1180057 for ; Tue, 3 Jun 2025 17:02:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 3 Jun 2025 17:02:04 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 8FA191140175 for ; Tue, 3 Jun 2025 13:04:08 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Tue, 03 Jun 2025 13:04:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1748970248; x=1749056648; bh=VEaBTv2pSLgZBRmaFYi/2 t8UfFAh1IDG3z9gS5v4pc0=; b=hMLHOUp9sxk3FUHzHv8yXfnyOSwfNmH5wqpTI 4t7t9YjVyjH0LSM2iHdWSB4eLZU8TML+M8rPaALnDWGk39wtFr8Bbrby3WlNmvqQ k2pVJQc7B+ZAYzeU4JAz75AYx8DG51sIfzffVBqqseJ0gno7zh1A9eL4o3KpxBoR y6Dq8mH/cazieMXKF8+RfbpjWLRg4n4OmgutkltWBG3gHn46qGnboQmVG2zDibaK HQI9qkzki9FzEciT7039wo3kums4+62TaxwYA/Xr88VDk3S+Q4AjLtkQLUFEm+2J eNHryKBDZ8hQIfa7h5cJFT8WvcgNfzeKWiLdr6e7zTGq6k7HA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1748970248; x=1749056648; bh=V EaBTv2pSLgZBRmaFYi/2t8UfFAh1IDG3z9gS5v4pc0=; b=MuQ8B+nP7uRSveVoG acbztuduH/U5iZQdNAsQ7zfD/44jf/mmt8TSOxTvhGSxzSr/5n+K5iuUeywxyvzs frmAsnPek/KZEiApgMq0w2JMz98id2GAFPOEUfVuVz/bBrdOzqBjZdpyidfmHi6D 9qjurB+M4tBqt0DfuRMXObgHS+u1HVOIEHyzSGTbj1rY0lLuIcx69389FvTeK5HR 1Io2brHwljNXLJBF44gNSImysc3W1NZm9X2HeKkn0OvjsYPGUA146ucra3+dqBiI P7kJV1jew+r+dBw3Xlp9HW7sG05qewoGmyKnHPVk5q7MkzWdVFnyDHHvwTNactPI bMYYw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdejlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecu hfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivg hlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddtgeet ieeugeevhfetheeffeefteduiedthedtgeejueeinecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghh rdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtth hopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3455C700061; Tue, 3 Jun 2025 13:04:08 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T81b2c40af9f93484 Date: Tue, 03 Jun 2025 12:03:46 -0500 To: "php internals" Message-ID: In-Reply-To: <28F14D0F-8483-418D-85D1-660564A4EAE2@nicksdot.dev> References: <28F14D0F-8483-418D-85D1-660564A4EAE2@nicksdot.dev> Subject: Re: [PHP-DEV] Allow hooks in `readonly` promoted properties Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Jun 2, 2025, at 11:34 PM, Nick wrote: > I would like to add, personally, I don=E2=80=99t believe the above is = dumb: > > ```php > class Dumb { > public readonly int $value { get =3D> $this->value * random_int(1, 100= ); } > } > ``` > > I think it is a legitimate use-case. > Why wouldn=E2=80=99t a `readonly` property allow us to format, cast or= however=20 > mutate a =E2=80=9Conly once written value=E2=80=9D on consumption? It = will not change=20 > the underlying value. > If it makes things easier for us, allow it. It=E2=80=99s not like this= is some=20 > hidden implicit behaviour. We consciously must add the extra code,=20 > hence expect the output to be changed accordingly. It's about expectation setting. If you see a property marked `readonly`= , it's reasonable to expect this to be true: $foo->bar =3D=3D $foo->bar; For a traditional field (pre-hooks), this would be trivially true. With= hooks, it may or may not be. Saying "well, that assumption doesn't hol= d anymore, deal" is certainly an option, but it's not an option we wante= d to pursue as part of the larger RFC. But that is certainly a directio= n we could take. > So, I would love to see this RFC to be implemented. > Maybe you want to move it to discussion? Then my separate thread here=20 > would be obsolete. I believe at the moment that RFC text is all there is. :-) I don't know= that it's worth opening a discussion without at least a mostly-done imp= lementation. Also, Ilija is rather busy on other tasks at the moment, a= s am I. (Unless someone else wants to jump in to implement it, which wo= uld be fine.) --Larry Garfield