Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127622 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 2A7AE1A00BC for ; Sun, 8 Jun 2025 12:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1749384955; bh=ViTHE/G98dlftLE9oq2KNnZyWKjexjs/2Jsc951+LbI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ElZTHNqjAfDiGVuen4VJ+RjOQJcK8ZT9Mo7AryNnTkhi2mGYBzYw6hGVA5Yz6QSiP poj9e4+St0BZF5zwRG67cg0b7kQ1Ma2tf+5KwS4hScRlTpe/zGWPIRGg9kdbPYt+6V eYsS93DoXIS1pdFdRiJrIi68P5MIkTdxpjc1fZM+UBNQo00yU14/zY0BXw5MyhhL35 6aSr53fINC3K4sLfl9HOFN27rmPXt9oitIes0oxpnVZ+cvMSOX/eoVWcwrjA3EOz9B k7HlZ+a+w9BZs57SxvKhjrQb+yaahKSbd5BjatqN5cHtj3JHW6lNMSLfeXudQVE58K c4T/4GxI8gxXA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DEABF18004D for ; Sun, 8 Jun 2025 12:15: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=-0.4 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,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-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 ; Sun, 8 Jun 2025 12:15:54 +0000 (UTC) Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-606b6dbe316so2108154a12.3 for ; Sun, 08 Jun 2025 05:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tideways-gmbh.com; s=google; t=1749385075; x=1749989875; 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=J7pUvU4lw3w23gTrJ15KjrN3OTFsIX/kH7r9wNOhcps=; b=JnV0bWJWqByOYP45PjrPzsaZFsHCNVze1Rk6XivvxEpsqb7MHS7dfYn2MWTYuFAYy1 OwYVPh0n6Y5cfa4it8qWD25byNRai9ppDIPZJL0uUJ4nCExQGcn21Xqqs+w3Q/brFjqM 8tsm78AWY7fkCqnOxELH2ATbikfWvLSjF15nd1zblOsDHCFrtcmsxVd9TgTir+HZyX6P EzZixg/a1IDxMKXXiioxeTvyd1bY0ZQIVr4QEmRfekBDUhOuviVPWv5d8B1W1pMsj/ex Z6hv3gWuICkTB3RzwicrcR/Z17Lpykvqy1qtzbalQQwhROckjZqMgXJMlGv2g1N3oJhI //9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749385075; x=1749989875; 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=J7pUvU4lw3w23gTrJ15KjrN3OTFsIX/kH7r9wNOhcps=; b=EqsKKOrDQQhyI4pEf7FgiaPsXzqpqkUn3Ua4KIB0VXfWzXVksFR3fohgQf6Wm1Dguw 6zJHgjaJWkbk/kT8ebZoOYO9XiUifMP/FwpbMwb/QAlBGH7q3EDRJlm6WQwAI7IWPd+O 9Pk+P5UFzJl57+m0hm2hoGMvfjHa/MJTD107UKYUnbdz5vtQeQrsh6AuuIE29aXQr5In PPTNkVSDT3ciDxS9tIRjwDvT28Ufrq7yKx4euWgf7vj+M+ZP3YAQs05Fo2hIiZdCzynv 0GnES85DG6WNDV876l6ZJzeY1zaOwPVbMpTbN4RU4eErrq4nKSZlZH3njUlmEVQEr4cA XMMg== X-Gm-Message-State: AOJu0YyAjXqgt8GfUnEScLiDCFeG/5NNG4w6U/erTGgSNifnJm1kFDOk 3PsRfHYFtgsSYSiiZyhx67BsGWkJClVzgCox/FPnRuJMsWSfRDsLUpkKrRt8oUtKzeVn6xuRh29 kI3pGrgdSbig3WL6Ma6MNbjJpqKyRe1QGTaJxLCXq3iJJlzTnS+CvEl8= X-Gm-Gg: ASbGncubJcXC7iy5penPgUsDTFfL+D1Ax4PiNdhvegA/WSbxC0ghh65Txz0+KYugocx C33bMKhlBNwBx8NSb98fnlEhMW3rPQdTZcIb2Zufboh5k/rZk0q8gsBVgJrlyops58wvj9PnsFM OidK6CyVt9pzROX3jtmeiJFTQnpfEl7GUmiw== X-Google-Smtp-Source: AGHT+IFDK8Tcvdc7K/iPbbS/PC+SE2KvSQYzWNf/DBbk7UScsoktXABic3WmSNf5e5Q+8v11qGX3L4smFAkFWCdn+7Q= X-Received: by 2002:a17:907:d8f:b0:ad8:a935:b8f7 with SMTP id a640c23a62f3a-ade1a8ec884mr878450266b.12.1749385074971; Sun, 08 Jun 2025 05:17:54 -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: <1e8634d7-ac1a-4025-b4e2-1948aabf5251@app.fastmail.com> Date: Sun, 8 Jun 2025 14:17:43 +0200 X-Gm-Features: AX0GCFt9Cw4w0xv___UVBUgDQZ_eEocuWmmLuJGSR904hHpBL5KWPBJhMuAweNM Message-ID: Subject: Re: [PHP-DEV] [RFC] Readonly property hooks To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000f82db606370e735d" From: volker@tideways-gmbh.com (Volker Dusch) --000000000000f82db606370e735d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey Larry, Couple points from a first read and from trying to run the examples. a) From the "ProductFromDB" i get: > Fatal error: Uncaught TypeError: LazyProduct::$category::get(): Return value must be of type Category, none returned in ... I assume you're missing a return statement here? Or is there something I'm missing? b) Minor wording gripe in the proposal section > On the other hand, there is no shortage of dumb things that people can do with PHP already. While I don't disagree that PHP gives people a lot of freedom in how they want to write their code, I find it a bit crude for an RFC to phrase it like that. And the __get comparison is strong enough to stand on its own. c) > That is, we feel, an entirely reasonable use of hooks, and would allow for lazy-load behavior per-property on readonly classes. I might be misunderstanding the sentence here, but on-demand/Lazy initialization of properties on readonly classes is already possible in classic getter/setter classes. Do you mean you want to have parity to this behavior when using hooks? I'm all for it, I just feel the sentence says this enables something that wasn't possible before but if you mean this in scope property access it makes sense to me. d) PositivePoint Example doesn't compile against 8.4, master, or against NickSdot:readonly-hooks Can you make this a script that runs and shows expected output so that readers don't have to assume this is supposed to do or run it? e) Backward Incompatible Changes Section is not filled in yet f) Date: 2024-07-10 Is this correct? I know you created the page back then, but was there a discussion already that I wasn't able to find? Kind Regards, Volker On Sun, Jun 8, 2025 at 6:18=E2=80=AFAM Larry Garfield wrote: > As Nick has graciously provided an implementation, we would like to open > discussion on this very small RFC to allow `readonly` on backed propertie= s > even if they have a hook defined. > > https://wiki.php.net/rfc/readonly_hooks > > -- > Larry Garfield > larry@garfieldtech.com > --=20 Volker Dusch Head of Engineering Tideways GmbH K=C3=B6nigswinterer Str. 116 53227 Bonn https://tideways.io/imprint Sitz der Gesellschaft: Bonn Gesch=C3=A4ftsf=C3=BChrer: Benjamin Au=C3=9Fenhofer (geb. Eberlei) Registergericht: Amtsgericht Bonn, HRB 22127 --000000000000f82db606370e735d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey Larry,

Couple points from a first r= ead and from trying to run the examples.

a) From t= he "ProductFromDB" i get:

> Fatal err= or: Uncaught TypeError: LazyProduct::$category::get(): Return value must be= of type Category, none returned in ...

I assume y= ou're missing a return statement here? Or is there something I'm mi= ssing?

b) Minor wording gripe in the proposal sect= ion

>=C2=A0On the other hand, there is no short= age of dumb things that people can do with PHP already.

While I don't disagree that PHP gives people a lot of freedom in= how they want to write their code, I find it a bit crude for an RFC to phr= ase it like that. And the __get comparison is strong enough to stand on its= own.

c)=C2=A0

> That = is, we feel, an entirely reasonable use of hooks, and would allow for lazy-= load behavior per-property on readonly classes.

I might= be misunderstanding the sentence here, but on-demand/Lazy initialization o= f properties on readonly classes is already possible in classic getter/sett= er classes.

Do you mean you want to have parity to this = behavior when using hooks? I'm all for it, I just feel the sentence say= s this enables something that wasn't possible before but if you mean th= is in scope property access it makes sense to me.

= d) PositivePoint

Example doesn't compile again= st 8.4, master, or against=C2=A0NickSdot:readonly-hooks

Can you make this a script that runs and shows expected output so tha= t readers don't have to assume this is supposed to do or run it?
<= div>
e) Backward Incompatible Changes

Section i= s not filled in yet

f) Date: 2024-07-10

<= div>Is this correct? I know you created the page back then, but was there a= discussion already that I wasn't able to find?

Kind Regards,
Volker

On Sun, Jun 8, = 2025 at 6:18=E2=80=AFAM Larry Garfield <larry@garfieldtech.com> wrote:
As Nick has graciously provided an impleme= ntation, 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

--
=C2=A0 Larry Garfield
=C2=A0 larry@ga= rfieldtech.com


--
Volker Dusch
Head of Engineerin= g
Tideways GmbH
K=C3=B6nigswinterer Str. 116
53227 Bonn

Sitz der Gesellschaft: Bonn
Gesch=C3= =A4ftsf=C3=BChrer: Benjamin Au=C3=9Fenhofer (geb. Eberlei)
Regist= ergericht: Amtsgericht Bonn, HRB 22127
--000000000000f82db606370e735d--