Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128002 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 DC7391A00BC for ; Fri, 11 Jul 2025 04:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1752208160; bh=vnQ4M7LkR9HSbONr7Femy1qz4KfT6XlwtsPHQRXOE+E=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=gbn1rzXdV1eSzsEZ/pELcJuKaF9XlBCK6iGM0REaRDjpsU/18drHpMUgLowuxtZ3u +B4XhMHqhCFuZ0lLrturU7tW8I1Otfo0tCE/6ZshiCMRE5S6Jl5eiPCZ32GX/TUL8T HgKKyzYhqeBIIuaHmWNFVCj5VNbCiQtnu3eVsg+i/e6Y/nyDINJ+dR/tN2tDGkONK0 fbwo/KXQcH5TCj+xg0CMKeDKOl1w7dV35LFR86FDiaoSy/RObzH8UqgMUC/44YaNr6 07gk1hWzCOw0Q8mdP3bWIPHPnfbTG0pXdeSnVXq+wohTkmgJVLg2WY56Vb9obVa5KB 8m7U0YLruiTQg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6907618061E for ; Fri, 11 Jul 2025 04:29:19 +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.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, SPF_HELO_NONE,SPF_PASS 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 avril.gn2.hosting (avril.gn2.hosting [84.19.162.247]) (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 ; Fri, 11 Jul 2025 04:29:19 +0000 (UTC) Received: from avril.gn2.hosting (localhost [127.0.0.1]) by avril.gn2.hosting (Postfix) with ESMTP id ED1B21C4082C; Fri, 11 Jul 2025 06:31:06 +0200 (CEST) Received: from smtpclient.apple (unknown [111.68.29.103]) by avril.gn2.hosting (Postfix) with ESMTPSA id 4B24C1C40816; Fri, 11 Jul 2025 06:31:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nicksdot.dev; s=default; t=1752208261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Ub59ci6Ke+xZDG9HUwnAQlyd+6b0qwAOUitFmGq/t0=; b=O4xtAS5hL2VWpqjFEN17OJr7aFQZ8EAw+XFZfPUkuu5y51TG6R1+vloZJaOo8+Ux2Cg+2K cLuR8jJtlYpWRgG/FCfSfKZlEipYcePVFdyXjhUzeNpwTZ+HoQGkcIgJzo4En1/gjeTTKE f9sT9eY06nUx1KuvKiyrRb8FGdEivgCiuroqysu42Y0Pil7Q1rkn7aNJiHzvkkyob+YtMo x4FAycwILYGPnSz+Iar6LcTiT7cUJqVMh8JrHwMZMfwlWfIixt8aS7iB4XwloJ8iDFxBXe qxU6ohMt6rSyJKc9JJEDQLhybZGZAcQ5YbC0AjhlOtxGFXg+uNkbPlkI/d7Dmw== Message-ID: <9D5043B2-1589-4FD5-B289-6E98FB1177BE@nicksdot.dev> Content-Type: multipart/alternative; boundary="Apple-Mail=_1FB10913-D5B5-462D-9516-ABACE5A87EF6" 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.600.51.1.1\)) Subject: Re: [PHP-DEV] [RFC] Readonly property hooks Date: Fri, 11 Jul 2025 11:30:43 +0700 In-Reply-To: <1e8634d7-ac1a-4025-b4e2-1948aabf5251@app.fastmail.com> Cc: php internals To: Larry Garfield References: <1e8634d7-ac1a-4025-b4e2-1948aabf5251@app.fastmail.com> X-Mailer: Apple Mail (2.3826.600.51.1.1) From: php@nicksdot.dev (Nick) --Apple-Mail=_1FB10913-D5B5-462D-9516-ABACE5A87EF6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hey all, > On 8. Jun 2025, at 11:16, Larry Garfield = wrote: >=20 > As Nick has graciously provided an implementation, we would like to = open discussion on this very small RFC to allow `readonly` on backed = properties even if they have a hook defined. >=20 > https://wiki.php.net/rfc/readonly_hooks >=20 > --=20 > Larry Garfield > larry@garfieldtech.com To not get this buried in individual answers to others: I came up with two alternative implementations which cache the computed = `get` hook value. One leverages separate cache properties, the other writes directly to = the backing store. Links to the alternative branches can be found in the description of the = original PR. https://github.com/php/php-src/pull/18757 I believe that these are fair solutions to address the concerns that = came up in the discussion, and I hope people will agree. Cheers, Nick= --Apple-Mail=_1FB10913-D5B5-462D-9516-ABACE5A87EF6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Hey all,

On 8. Jun 2025, at 11:16, Larry Garfield = <larry@garfieldtech.com> wrote:

As Nick has graciously = provided an implementation, we would like to open discussion on this = very small RFC to allow `readonly` on backed properties even if they = have a hook = defined.

https://wiki.php.net/rfc/readonly_hooks

--
=  Larry Garfield
=  larry@garfieldtech.com

To= not get this buried in individual answers to = others:

I came up with two alternative = implementations which cache the computed `get` hook value.
One = leverages separate cache properties, the other writes directly to the = backing store.

Links to the alternative = branches can be found in the description of the original = PR.
https://github.com/php/php-src/pull/18757

I believe that these are fair solutions to address the concerns = that came up in the discussion, and I hope people will = agree.

Cheers,
Nick
= = --Apple-Mail=_1FB10913-D5B5-462D-9516-ABACE5A87EF6--