Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127962 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 F180E1A00BC for ; Wed, 9 Jul 2025 06:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1752042535; bh=VOadPzYOO2NJ60HZ3WqMz0zZVI84FEznOk0QKzNC0Z0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kuicNpPHT15BgcourmwMqc1dVTyu20I9Ro766+g0srIPJD0L33DuS1FHsQm8lJ9kC oVmCFPehe5cDzpTMEirufN9fR/DBTkbWbp6XPWSLaZ4BTNVP+T7sPMOIbjvnWswQwi WKsoYJAbkCN9vkqgIVHusQyJGEJM2NGaZIRVzT5QwB8HriOQtVSByVSYO9bF71n4H0 e6aXt3BY4HZaBC4X0zpwU48Crm0JYWWSiT2wyJvuqlklvp9clgXEDkcunQn8IXCjhB fqljDMFasj8WYQDksPwVA5tO1nWukdCmhoe6wA35pXP0wNWSXWU7BIgDvW5O7a0VNV 2g64yurFy2hDw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 88855180645 for ; Wed, 9 Jul 2025 06:28:54 +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=-1.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 ; Wed, 9 Jul 2025 06:28:54 +0000 (UTC) Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-32ac42bb4e4so42229031fa.0 for ; Tue, 08 Jul 2025 23:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752042643; x=1752647443; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Cf14FHxdRHYLpjeSURv4NAzTkn1/G6RPngdXamQPE9w=; b=VeqbuLfizag7F719UQltC75siIrf0Q2s3CdbuqdKjOGJj6IEqgPaIDb24MnHcxPGv1 oP5FEVydbTGqWTzgXkBuvEZ9ZrFZvqO9wivtkjRjCW7ulRV9RzMDuR0ZdI5DHurw2AVu rrNk0PVUIPcX0SwIqXO1QprEqY8v91pln9LG/PlRr9I8N/8ZxF3d2MTt8J9JbEQ2coGi D5Q8ixVvo4zYoBRAGBAx3idUoQoFUfSahwf2ArswsCpPU4O/GTJn0z3A3qKxVSzri4IV LpNwcMjr2OwapIrf65yfSvSpLQlpKirgPmJDmT0+Hy6bxzRw2Xx+eDKpsfj8m6HKPG13 HwdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752042643; x=1752647443; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Cf14FHxdRHYLpjeSURv4NAzTkn1/G6RPngdXamQPE9w=; b=e7tbuzMtJfrgzKbXJURnxA7fawRsw/iYnKcFhkLql+q51iJCTsnrLl6TM7aAepAROf Or54nIAQ8q00PoZViC6acgSwKNDBOlEpQFEc2IZxqYFNdCprbpVtVZ/7YE26Z93o3o1A CubZnI64IcSPtXmQdw+cgcEb9DXOKG1xTf4QOreZMs9z2WLtoA49ZtYdjne3w6KOj3eY iKhcsBfm4UQqPFryArWpQIMolhqG2teZ8nF8y3y2RUQuG14rFZHrh0ijf97A7KOv6uIt HepPoDY4tnnioFGt8EK6GlYQ253KbbGJPsmrdIU3VrJk1USTeNNwpCPocphXW1gl4uli ZJhw== X-Forwarded-Encrypted: i=1; AJvYcCVn4J5YdmPobZTTC24Q1R5Us1EhZvCAtLAbwZmUlC0BJ0dQhUxvuiIKlv+z0ncXGgHRPShDJYN4VC8=@lists.php.net X-Gm-Message-State: AOJu0YyLb+wqzoREua0PIUdLkJ5eji+G6tWUAhUPczDwQiH8DkdaTiuI uDIi2rpU05S9y4Ey6jo3QVpMRoqM9TKYWWJNXMjM/APFjDwQRfWXsOJzAeo8zRoXX5Hm9vYgYx+ xwJSu5DKWMdADu7wQypBRZkm1INzsygo= X-Gm-Gg: ASbGncu8wGLmuV7r5imLM/BrD1Ly/phGw1XEPmPIv8h3DqnnsGADLa5sO2PvR5Bfvey 3tnqEwUeBwnPxy9YuGUSi4bwCpzqTWqpRYDbijNjmv93QYHccL5axovk4C1vRUIkzmGbHyCWAxx 2johbRFte4STflLTvcXRMZKpLkADObwCtP2KZODgDjVr0= X-Google-Smtp-Source: AGHT+IHd7iDDPkzOxU4gVAlhtwAfZBdyqXUjaz2ZxZ1MDV/lykVNDuqCCSGcl7cb+D0j3VNs9w81hep30x+KRGJON1w= X-Received: by 2002:a05:651c:154b:b0:32b:8989:eb72 with SMTP id 38308e7fff4ca-32f485e557fmr3388821fa.40.1752042642653; Tue, 08 Jul 2025 23:30:42 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <1e8634d7-ac1a-4025-b4e2-1948aabf5251@app.fastmail.com> In-Reply-To: Date: Wed, 9 Jul 2025 08:30:31 +0200 X-Gm-Features: Ac12FXzSj2yA2nywZmlOlS9EN9jygCuW47TKhfvRwsr6klyGurKCewGg6_Mj8Sc Message-ID: Subject: Re: [PHP-DEV] [RFC] Readonly property hooks To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="00000000000058c63c0639793735" From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --00000000000058c63c0639793735 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Tim, Le mar. 1 juil. 2025 =C3=A0 16:29, Tim D=C3=BCsterhus a = =C3=A9crit : > Hi > > Am 2025-06-09 17:11, schrieb Larry Garfield: > > I also fleshed out the __get mention with an example that shows what > > you can already do today, and in fact could since 8.1 when readonly was > > introduced. The hard guarantee of idempotency has never actually been > > there. (This also speaks to Claude's concern.) > > I don't think this really resolves Claude's concern. While it is > certainly true that the guarantees do not currently hold, I don't > believe this is strong enough of a reason not to provide for stronger > guarantees in a *newly introduced feature*. The point of property hooks > is for me that =E2=80=9Cdynamic properties=E2=80=9D are easier to reason = about compared > to `__get()`. As a user when accessing a proper `readonly` property, I > do not want to check if there is a property hook that might result in > non-readonly behavior. As an engine developer I want to be able to > optimize based on the `readonly`-ness of a property. Without such > guarantees, the =E2=80=9Creadonly=E2=80=9D keyword does not provide value= to me. > > I also believe the LazyProduct example to be broken, since lazy-loading > individual properties might result in an object that is internally > consistent if the database changes in-between. Here are two situations that are perfectly valid use cases for the example: - event-sourced / versioned entities in the DB, where the state of an object cannot change in the backend - lazy-parsed network payloads, where one parses only part of some JSONs on demand (mongodb and symfony/json-streamer do such things already) Nicolas --00000000000058c63c0639793735 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Tim,

Le=C2=A0mar.= 1 juil. 2025 =C3=A0=C2=A016:29, Tim D=C3=BCsterhus <tim@bastelstu.be> a =C3=A9crit=C2=A0:
Hi

Am 2025-06-09 17:11, schrieb Larry Garfield:
> I also fleshed out the __get mention with an example that shows what <= br> > you can already do today, and in fact could since 8.1 when readonly wa= s
> introduced.=C2=A0 The hard guarantee of idempotency has never actually= been
> there.=C2=A0 (This also speaks to Claude's concern.)

I don't think this really resolves Claude's concern. While it is certainly true that the guarantees do not currently hold, I don't
believe this is strong enough of a reason not to provide for stronger
guarantees in a *newly introduced feature*. The point of property hooks is for me that =E2=80=9Cdynamic properties=E2=80=9D are easier to reason ab= out compared
to `__get()`. As a user when accessing a proper `readonly` property, I
do not want to check if there is a property hook that might result in
non-readonly behavior. As an engine developer I want to be able to
optimize based on the `readonly`-ness of a property. Without such
guarantees, the =E2=80=9Creadonly=E2=80=9D keyword does not provide value t= o me.

I also believe the LazyProduct example to be broken, since lazy-loading individual properties might result in an object that is internally
consistent if the database changes in-between.

<= div>Here are two situations that are perfectly valid=C2=A0use cases for the= example:
- event-sourced / versioned entities in the DB, where t= he state of an object cannot change in the backend
- lazy-parsed = network payloads, where one parses only part of some JSONs on demand (mongo= db and symfony/json-streamer do such things already)

Nicolas
--00000000000058c63c0639793735--