Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128121 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 DE8721A0130 for ; Fri, 18 Jul 2025 17:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1752858521; bh=XA+WEzVzrSOVR74Klqviex0DNNHhQxpnWS2cF/O1QdE=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=GQ5G+NA9xcziC8O3O3cz4IRMa5v4zzj6qIRkGQbhbaHF3plTtBYAmHClWGTtWSxu0 GASFW5B6LJ2XBEt0x6KBlKkRyYCAZ7hXIWJt2CoOdKNA7XHrF40pWtAvFjj8LyVoxE PRZIRanox9UYZzJEuiSiNPUJsJ3oJNlkL75VAGaRvd33QEZDbo7Qnq6eDOCtnkr7uw tykyE2ZXBm8GI54ynZWcfUhyAe5fx1YJ9eK/RFYRGBn7Tw6+yHk7U3ksmqAe00okbB YUFuzQe5beTNXCGUqVyUTaaGlFklia9ue4ELVNwo9Pw8N28B79/9b3Yg9VkXFXu6L+ DCY1E7LI2BpoA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 34E01180706 for ; Fri, 18 Jul 2025 17:08:40 +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.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,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 fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (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, 18 Jul 2025 17:08:37 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 6D9F01D000D5; Fri, 18 Jul 2025 13:10:23 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-04.internal (MEProxy); Fri, 18 Jul 2025 13:10:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mjec.net; h=cc :cc: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=1752858623; x=1752945023; bh=XA+WEzVzrS OVR74Klqviex0DNNHhQxpnWS2cF/O1QdE=; b=mMPBXuDSJ1sgMSEmXT4f/jv/Jr 1W7rQXDM2wzVtvQSrmIB1ejT1Id9Mg0Qbf+02Krtsxm8eGwNWoeCKwfhdgM5irJo aa2gLeBipRtnLzJhyIuR1WZYCDudslmwossm2nq1PDgGzB9G3kAxFLLTQJ/0iUAW h1Vq43fkFaEerIlwlVoqM3EzHuHHPvSW03c0lZ2JwdM/79ZauSvAGTFkG2fd8o+u llhW/sduLVQmIiqqXjhCa1EWHZYZGGbbiWRIddo0fLEC4ZUZhzVqwtXzcI8PBVLe 7cLiI0gXXb4LU/gJ1iVci49fY/PVw/1UxqfnWl2mSwW4pp0oQM7gbunwJF9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= 1752858623; x=1752945023; bh=XA+WEzVzrSOVR74Klqviex0DNNHhQxpnWS2 cF/O1QdE=; b=YunNeX1mWsDrBoJvm71DHF5KVObZA5LZUqAsF4EPA3MdpoUClta KBMqwe7AfO2zpTqaptFXeYzTNs93aqsqK5zXfCngkOY06WrCVTYuKfcce55qnot2 V6AjZUZJ7lGIlCbNWA9yCTzeuy0GnxtBTj1y6TfKNANLbk5jICj/EkP3oP4v0cDE G0x3JkMewIl0C0UKzpREfYqDJQsxBZbyu9UOBFiUbRtZf3DYWG+ZuALY321Al2vE YbVrvzWjA9tNm18OLLu8egpn9iDEV2YV/lbIWDX0q9B/2igJF5S2Gz6RYPOYHLRj WkyzjIaryHRYhQWJYaIWTqdD3+EQ4WXn5eA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdeigedtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvvefkjghfufgtsegrtderreertdejnecuhfhrohhmpehmjhgvtgcuoehp hhhpsehmjhgvtgdrnhgvtheqnecuggftrfgrthhtvghrnhepgfeuieeiueefkeffudejie euuddtteefjefggfehleefgffhvdefjeegvdejvdetnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepphhhphesmhhjvggtrdhnvghtpdhnsggprh gtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehtihhmsegsrghs thgvlhhsthhurdgsvgdprhgtphhtthhopehrohgssegsohhtthhlvggurdgtohguvghspd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: iea414789:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 0D9BD2400094; Fri, 18 Jul 2025 13:10:23 -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: T0da4fb45db700012 Date: Fri, 18 Jul 2025 13:10:03 -0400 To: "PHP Internals" Cc: rob@bottled.codes, tim@bastelstu.be Message-ID: In-Reply-To: <0d9a2968-26dd-43dd-9733-d2eb621ab9ec@app.fastmail.com> References: <1e8634d7-ac1a-4025-b4e2-1948aabf5251@app.fastmail.com> <9D5043B2-1589-4FD5-B289-6E98FB1177BE@nicksdot.dev> <0856c89f-2000-448a-bbbf-c145a8699f6a@app.fastmail.com> <2641b8bc-6337-4b75-a5a3-93dee1b03796@bastelstu.be> <0d9a2968-26dd-43dd-9733-d2eb621ab9ec@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Readonly property hooks Content-Type: multipart/alternative; boundary=888837749f7a423c8f12abe139d5a722 From: php@mjec.net (mjec) --888837749f7a423c8f12abe139d5a722 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, 2025-07-18 at 11:49 -04:00, Rob Landers wrot= e: > On Fri, Jul 18, 2025, at 17:25, Tim D=C3=BCsterhus wrote: >> A readonly class is not just a convenience shortcut to mark each=20 >> individual property as readonly. It has important semantics of its ow= n,=20 >> because it forces child classes to also be readonly. And even for fin= al=20 >> classes it communicates to the user that "I won't be adding non-reado= nly=20 >> properties to the class". >=20 > Wasn=E2=80=99t that the entire point of readonly classes? Because it w= as painful to write readonly for every property. Then if a property is r= eadonly, the inherited property is also readonly, so, by extension: a cl= ass extending a readonly class is also readonly. >=20 > There=E2=80=99s no =E2=80=9Ccommunication=E2=80=9D here; just logic.=20 All code is communication, not just to the computer, but to other humans= reading it. This is why the semantics of the terms are important. I agr= ee with Tim's interpretation of those semantics, and hence vastly prefer= an init hook to get in these circumstances. Importantly, this RFC can clarify the semantics of these terms for the l= anguage as a whole. That specific meaning can be documented. If a propos= al does not come from a principled understanding of what `readonly` mean= s - what it indicates to users of the class - I think that is a step bac= kwards. mjec --888837749f7a423c8f12abe139d5a722 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Fri, 2025= -07-18 at 11:49 -04:00, Rob Landers <rob@bottled.codes> wrote:
On Fri, Jul 18, 2025, at 17:25, Tim D=C3= =BCsterhus wrote:
A readonly class is not just a convenience shortcut to mark each&n= bsp;
individual property as readonly. It has important semanti= cs of its own, 
because it forces child classes to also b= e readonly. And even for final 
classes it communicates t= o the user that "I won't be adding non-readonly 
properti= es to the class".

Wasn=E2=80=99t t= hat the entire point of readonly classes? Because it was painful to writ= e readonly for every property. Then if a property is readonly, the inher= ited property is also readonly, so, by extension: a class extending a re= adonly class is also readonly.

There=E2=80=99s = no =E2=80=9Ccommunication=E2=80=9D here; just logic. 

All code is communication, not just to the comp= uter, but to other humans reading it. This is why the semantics of the t= erms are important. I agree with Tim's interpretation of those semantics= , and hence vastly prefer an init hook to get in these circumstances.

Importantly, this RFC can clarify the semantics o= f these terms for the language as a whole. That specific meaning can be = documented. If a proposal does not come from a principled understanding = of what `readonly` means - what it indicates to users of the class - I t= hink that is a step backwards.

mjec
--888837749f7a423c8f12abe139d5a722--