Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129897 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 895B41A00BC for ; Fri, 23 Jan 2026 15:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769183714; bh=Vdz4e0GZWLuoJavGkiJpL4Wtv3cDfiKHsLek9C5LyhQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=DeAyikRDVdw2Yw/rcokSPZbwV4SC8KihGAXHZ7scb0plRJc9zycDek94DmwYvuObc VjjBj5qe8b6TiTcWfuOH0U1DwxxTLTkS6TdY0gD9mvtKbaSY8J2uWA1D3h8E2oqfQP HRP6CsNcqqAqdzQLtTZNy7V5C6d2c9i6GNL7ira+g8c1tVcIA+nDIDVeGVa53ZjrYq 5nX2hRZnGrHibFynUdlAFZpDxPlqyKNgJOwyrxXkTbHu1hcwuVZnpyl5+44sSIaDKL d6/k5RNcaC3thZ/iCIkVTfAQ9znfP3lUQ3P2v3rN3LqBVLcO7Dh5KSt4qSkHp9C7uP QV8zmGMBGClpw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 81D4318066F for ; Fri, 23 Jan 2026 15:55:13 +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.1 required=5.0 tests=BAYES_50,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: No X-Envelope-From: Received: from fhigh-b1-smtp.messagingengine.com (fhigh-b1-smtp.messagingengine.com [202.12.124.152]) (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, 23 Jan 2026 15:55:13 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 2DF127A0108 for ; Fri, 23 Jan 2026 10:55:08 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Fri, 23 Jan 2026 10:55:08 -0500 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=1769183708; x=1769270108; bh=jTWtDQOxmJC75LcWLOH7z pMptSxfT2BoVhfjCZsOPSk=; b=Oy1qMW/lQ/NVBRllMcyh/dGeVBU9bqlATdbml VohcMSaJ3IBRTHLoMQJEX4MWMCVbfOQIh/gs8RM8d2+grz5NvGI168FBe1gCztaJ diAHXBfw6ruTYZYSwZuR2+Hs8FtWXlYTivbwcfqLsLVTYAyJLqGgBs7brkATkXAA sD75BWxjJRa5dq+lFH6wdJtlPGsMhNYO/9/RTfKduA2dRXi9V/U/frhvEJr3BMpi AZcChrIQadA9S96ENFKrrigmt1luLDQ0I4CHJ3EOScVz1saoxyDRC8Q6NRuGSg6v ogdvGP1+uaeC4VzCbaKdFtHxVqCRLZbcNZZYK0qjUMNKDKdsQ== 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=1769183708; x=1769270108; bh=j TWtDQOxmJC75LcWLOH7zpMptSxfT2BoVhfjCZsOPSk=; b=S2bCtWGcUWh+PPM3X 9Rm9WSiSfASXUPJiNUCkRTCb98Icg3nrIMAOCuIsXX9zLk18RqZgu3YN8QTsS5rl 4GnFE02brzSL6Xc2/WrJ5kyiEQCWl8X52DLWJWF+plKRrKxzSqJ7YYGZFz0VYkMh oKIIEhFvYPGxylUW03wJ51s6sBGsx3u0ok7y8PXWNDidzyQDYkbvfNccQlFLq67E FpTVw6WM5G+qRYcXzOfLoUsG9e77XiEG7cr0MT3QYbS8STALZ06pv7nz3BJ3NPXD uajGsSUGITleZTy5DVdcfUVWFR0dh97lUXXsfQr0noGqsWX0RBqjuobjjRzv76ct BBDhQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddugeelgeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdef iedvtefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id DA3BF700069; Fri, 23 Jan 2026 10:55:07 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: ApWOO0YdA2Vg Date: Fri, 23 Jan 2026 09:54:47 -0600 To: "php internals" Message-ID: <85e10caa-f577-4f8f-a93d-955348b67013@app.fastmail.com> In-Reply-To: References: <077e27345a1f5b7969c114684aede7e8@bastelstu.be> Subject: Re: [PHP-DEV] [RFC] Allow Reassignment of Promoted Readonly Properties in Constructor Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, Jan 22, 2026, at 11:26 AM, Nicolas Grekas wrote: > Thanks Tim, Larry, > > Le jeu. 22 janv. 2026 =C3=A0 17:21, Tim D=C3=BCsterhus a =C3=A9crit : >> Hi >>=20 >> Am 2026-01-22 16:33, schrieb Nicolas Grekas: >> > Here is a new RFC for you to consider: >> > https://wiki.php.net/rfc/promoted_readonly_constructor_reassign >>=20 >> Thank you. I have taken a look and have the following notes (for now): >>=20 >> 1. In the Problem Statement: =E2=80=9COption 2: Use default parameter=20 >> expressions (limited):=E2=80=9D >>=20 >> The example seems incorrect to me, particularly the =E2=80=9C// Canno= t use $x in=20 >> default expression for $x=E2=80=9D comment doesn't make sense. Can yo= u check you=20 >> pasted in the correct snippet? >>=20 >> 2. Within the proposal: =E2=80=9CThe reassignment must occur directly= in the=20 >> constructor body of the declaring class (not via method calls, closur= es,=20 >> or other indirect means)=E2=80=9D >>=20 >> I believe this is inconsistent with `__clone()` where the readonly=20 >> property remains unlocked until the end of `__clone()` (and is then=20 >> locked). >>=20 >> I'm seeing it is explained further below as =E2=80=9CThis restriction= exists=20 >> because the check verifies that the current executing function is the=20 >> constructor of the declaring class. When a method or closure executes= ,=20 >> the current function changes, even if it was called from the=20 >> constructor=E2=80=9D, which effectively means that you defined the se= mantics=20 >> based on the implementation instead of the other way around, which I=20 >> consider problematic from a language design PoV. I'm positive it is=20 >> possible to find a better implementation here. >>=20 >> 3. Within the =E2=80=9CRFC Impact=E2=80=9D section you removed the =E2= =80=9CEcosystem=E2=80=9D=20 >> subsection from the template. >>=20 >> I believe mentioning the ecosystem impact is relevant here. This chan= ge=20 >> will likely require adjustments to static analysis tools and IDEs to = not=20 >> point out the now-valid assignment as an error. >>=20 >> 4. As per the updated RFC policy. >>=20 >> Please already include the (closed) voting doodle in the RFC so there= is=20 >> no ambiguity here. Don't forget to include the =E2=80=9CAbstain=E2=80= =9D option. My=20 >> suggested title would just be using the RFC title followed by a=20 >> questionmark :-) >>=20 >> And please add a link to the list archives to the References section=20 >> (it's required per the policy and useful for future research). For yo= ur=20 >> convenience, the correct link is this:=20 >> https://news-web.php.net/php.internals/129851 >>=20 > > > RFC text updated to account for your comments Tim, good catch and=20 > thanks for the help around RFC processes. > > About the assignment rule, Larry and you have the same reaction, so le= t=20 > me take this as a good description of the most expected behavior by th= e=20 > community ;-) > I made the more restricted rule because I thought I should start with=20 > the stricter rule, and I get that would also be surprising somehow, so=20 > let's relax that. > > PR (and RFC) updated with the new logic, similar to __clone (and as=20 > boring as it can be ;P ) > > Cheers, > Nicolas Boring is good in this case. :-) I like the updates. I only have two r= emaining quibbles. > All other readonly semantics remain unchanged (no modification outside= constructor, no unsetting, etc.) As previously stated, "no modification outside constructor" is not, and = has never been, part of the language semantics of readonly. In fact, th= e RFC has been updated now such that updates outside of the constructor = are allowed, provide the constructor is in the call stack. Please remov= e that clause, as it is incorrect. And the LLM question, which warrants a separate discussion, I wager, and= is not an issue of the RFC text. --Larry Garfield