Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127958 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 4138C1A00BC for ; Tue, 8 Jul 2025 15:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751987346; bh=M6x6ni8mpAXJ4aaFGdsC6qazTANBaMRgZbKlxFzhxe8=; h=Date:From:To:In-Reply-To:References:Subject:From; b=LfjyH1g1J6cKlkBRtD2NcDQ2NBISmxYh0zPPAbqVoY2Am+SrOytVzN0FKDHQXHrT5 EpFAPlSsc7v7S8rCsmnyXIxWTS6hnWOVcRMpNGDBNhmYKVx6i3XIIn4EBMB0ls2k0U WHs66+3ikFyOOcCQ2UuuHS4RgXqOp1C8K/yxr/wb44CxQawSyu6ONg9xLah4wrTxru dgRtEwyopAoNRTGYv/JgCPFVyWIh3uoFLkbn/saAPYsI8EIePIKOsG5YuiA1maeph5 vtkoU9mGI8h3qp+1G9pJqW88qMPQArXCLttu4qamS9mWFKyAy45J8zcqaxCnE/etRu mJ+RXLlySYqng== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D02DA180054 for ; Tue, 8 Jul 2025 15:09:05 +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=-2.8 required=5.0 tests=BAYES_00,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 fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (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 ; Tue, 8 Jul 2025 15:09:05 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id A763CEC0BBA for ; Tue, 8 Jul 2025 11:10:55 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Tue, 08 Jul 2025 11:10:55 -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=fm2; t=1751987455; x=1752073855; bh=RNTm1HGnCLiN66kQvGy1A dWQ2kFYuvrvswlm3q2qFzU=; b=Q5YWkcae4KahrfAK43mghvSsq1d6CB4/Cgx0Q vJZRPtFJzfEt1w51mCVSUScpC+9g7J5BpBXRb2doxV/sQfadKAyLoPvDP3JI1P55 K+d3/9jJTfcXRXzjSKDcsWacEOI6U93x2C2hteoPvIgr6KJr0D7h1FhYM7bE0KAv 3bjD+vkdhnJ8jPy5iE74f/imAbBmlEZzBCiUz9qILj6j+q6odki2UWJnxdcvAiCx fogavmClKlHDsJDJh8GyYpKMElUNdXwR4d11nk7dT3SE1gGiRndKdiCITLV0C5G1 PxL86teD6b4kCmGJyCarO5vfZBLWq8Ju29YRYuAfE0pt6O4Sg== 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=fm2; t=1751987455; x=1752073855; bh=R NTm1HGnCLiN66kQvGy1AdWQ2kFYuvrvswlm3q2qFzU=; b=mjeYbk8Y7TLytgVPu jhqnMnnWdnMggZmArrgRL1P0Ti1dSFykTyiwzTD+o9N9en33YifSIIhXo2u0u8cS RGIJNGfE8gzMpMeDhQ59iy+XbICZjpZXxmHORTaOIEyC0BlgVMJuC5nSu/6nPw5c CUADhMT4PsNDXkn1PoParl/rQo4UQO0IHMfsgVNR6P+DOttxoU2W9eujvR80AAvD qnN07M546aKhNsFneQvR8fQq/1UOAjihlFaXzIFOzRGg2dTE3uI/Qzic2HRvoF4K cF0b/pO1x58wyReEzXY04rfwE4BYA2p1vvZj74i8c+8siDrFpGO5LtLSaLbwb7Pb Tplzg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdefhedtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddtgeetieeugeevhfetheeffeeftedu iedthedtgeejueeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphht thhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhsse hlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 277B9700068; Tue, 8 Jul 2025 11:10:55 -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: Taa1a9d92243b6726 Date: Tue, 08 Jul 2025 10:10:33 -0500 To: "php internals" Message-ID: In-Reply-To: References: <1e8634d7-ac1a-4025-b4e2-1948aabf5251@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Readonly property hooks Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Tue, Jul 1, 2025, at 9:27 AM, Tim D=C3=BCsterhus wrote: > Hi > > Am 2025-06-09 17:11, schrieb Larry Garfield: >> I also fleshed out the __get mention with an example that shows what=20 >> you can already do today, and in fact could since 8.1 when readonly w= as=20 >> introduced. The hard guarantee of idempotency has never actually bee= n=20 >> there. (This also speaks to Claude's concern.) > > I don't think this really resolves Claude's concern. While it is=20 > certainly true that the guarantees do not currently hold, I don't=20 > believe this is strong enough of a reason not to provide for stronger=20 > guarantees in a *newly introduced feature*. The point of property hook= s=20 > is for me that =E2=80=9Cdynamic properties=E2=80=9D are easier to reas= on about compared=20 > to `__get()`. As a user when accessing a proper `readonly` property, I=20 > do not want to check if there is a property hook that might result in=20 > non-readonly behavior. As an engine developer I want to be able to=20 > optimize based on the `readonly`-ness of a property. Without such=20 > guarantees, the =E2=80=9Creadonly=E2=80=9D keyword does not provide va= lue to me. The only way to make the readonliness fully guaranteed would be to force= a readonly property to be cached; (IE, the hook is only called at all = if the property is uninitialized.) But there's no obvious way to make t= hat clear in the code that it's what's happening. > I also believe the LazyProduct example to be broken, since lazy-loadin= g=20 > individual properties might result in an object that is internally=20 > consistent if the database changes in-between. That's true with any lazy-loading scenario. The use of hooks doesn't ch= ange that at all. --Larry Garfield