Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129870 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 C21321A00BC for ; Thu, 22 Jan 2026 17:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769102825; bh=5uCHBMse57GLbPeZ72nalqPdRAaW7pyDdykJnXV/A30=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GlJW4LgMDsNM4WaqLr3bD83fe063ag1Z4E29XWuyehJ6Jt9O35xAIjhfyp0uqwgN1 O93IH2Wq/gSH9Idaya+aa8flfdOysFFAumdLBJVsowlfQtLFDyRmfrN35O+qbCzBBc RMcwjw/VACprYbOKIIUKNjK+EXXa/i9QIUutMlwMIUlG86yuH2Wno2J68YqRCWfMgX V40pO2r7tqAR0N7KF7caZ54f47rwLrXtxwtRgTACqhaPdfawIq18lZ9HVvqyWVR8BJ RvEwY4qpZRlh36A1vnCkb9T2AmPogZ5J54d57cAsUyLUORGOZBbQujd1P7MKjrULi+ z/XEpu+4b+jXg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6DF88180081 for ; Thu, 22 Jan 2026 17:27:04 +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.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, 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: No X-Envelope-From: Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 ; Thu, 22 Jan 2026 17:27:04 +0000 (UTC) Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-8c52e25e644so123769785a.0 for ; Thu, 22 Jan 2026 09:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769102818; cv=none; d=google.com; s=arc-20240605; b=PZOJXfzbKX7y8DdV48EojmJQ4X+uWkL1/sLQEAidWvvvFIZMKpOjGvcYbdSySNIrSg Qj4QzRVKSBdSeGAU3HoR6Hr5bm/F0upeGYa7B7O6vVYiySt12Z1KVF34s1OSsZZFLHBj Q3WN8592ezbiiF7gx3SpVzU367CIwFXeh3RNNfiWr8ebtINWHd3TjACSPmHoN3F34JdV 69JzTU6VNJjoKoo2zqbvYyHoEnm4mBa1tHcMdC0pRzfEfXYqkuPdfnnuy7ltbmlZ30lC 3P1uG92vBI9TAOGumKJaNwDsCd+7a9nxBYAaD0F+OXfVpUu1Uxtvrtcc7Dd6Sa6s+Zpg WLIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=5uCHBMse57GLbPeZ72nalqPdRAaW7pyDdykJnXV/A30=; fh=NSVfPbOHxs0BB1JWNjCFs/waKbaL4AGxoT5Pu06Ru40=; b=FUEly3BPQZeTrm5wqVzmrfFjf+TZe0QGLzVzFXcZCzTADbwlyMGqcGItEEyX2kw/AU qakQ+rH1a9NBOTS3FsIoziJmNnuwh3d91dWpq9Tbu+ci2Y2r+91ZkpJPjrT3/7cGklFT BdKM2F+Ok2w5NWlN8lCBdtKR9bHTp/wDsgu0cRHhJ0o8HNBnH72T1aCUDQYPt+Ilq99/ lODzgumvalCCqheSIVolknJLg9dQRSia9OMSuAO1SPuTnFgGZNrvg5dzC/rLWKdgo1aT 2SuEupOIhWVFownTPmLLEdY8DqfnaOG5Iswnr/l3+T0DwPce7dKTUR4+VDZZDrmCQOt2 ujlQ==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769102818; x=1769707618; 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=5uCHBMse57GLbPeZ72nalqPdRAaW7pyDdykJnXV/A30=; b=X0DBTa4jZccQMT3UOj9gHnVnNPT/fWDsKKbFfy3MGtPaVDnw9zyQIZg0jnCfRd+MgM uo2wDpVdFuJvwh0SVhnf0PDns+v5E8KH16A5UII7Xvr+C1g5pBhOYBCMMVSMwAvl73zX MAFcp5y5QJX+Um68Ahf/2iwD/LGZbL0PeGAL5V+Lu8Lgp0GIiQa5oqB0XAEsEsnzh+8K y6JIQ9ylCf8HaogDNtDganwJwtsR5B807ImqGoB6btdugPihmFvsdvWKE1JJw8LW9KeR QtyFQdgq6LJLVNtWkVCKkEg9yVLSuL7mb/WYwSQw2mZCjrT4BD2qi8w5bO7JHodz7bRk 0fKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769102818; x=1769707618; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5uCHBMse57GLbPeZ72nalqPdRAaW7pyDdykJnXV/A30=; b=DloD5EHTEkWExDVomQtkiraYAFzO0WVNBlIJ94oK5fY4c5m2UIaSaRlTrWr4CBB9R5 LeVcZq2pZ5oi8OZpWzCSjfHnEZZAmE18wv/4EVqDQ1fl7IVGUddBkWJoDUoYzrBnIDFT NNKniBtV6leHm72Vw1i6+EDxIXbbgMSV00Cm1MuhnBBn/3+RmRrXMm1D6EemAm8Amo4N Ktzt6jbPYpe0JJtm4N8O/pnrbnNS6LppxWRtSvV8ODxe65zjZLZhf6GO2X804h2FDOK2 PQ3smyLPkWGWxp66XF7Vl4rp5EJ8K6Rb1BlgyXZTYCzFRUEAaW6CvbSPDM6Ic6BpGwaf qjMA== X-Gm-Message-State: AOJu0YzKTyyL619wlcM5y7uV6iI5u0evx+sGUJWBBxtjvDdLlhuFkyu1 /h1/4iQeqPIdELRyaziWLcLXDrY32uTDN+a612MI1sMD/2W7ElQDYidlGdwW72qwU4X2yaA+bTl NwaGGyf1Byni9XFnjjYcwNaYATKPsrk+rEuzx X-Gm-Gg: AZuq6aJszfTICtlokaKuAktNGGeLw8ZX+fDJJLymF6yxxWQStEQl+izMTfMKL5V/J8S 3BRTJOoTUljTDyUOL1JzZvbDPOFu2uXm9tC/Gt8Si5Hg4c6Sh0pTrlM8k/uznAsPFp/hYD9pWyh pwZ31wOCFRkOD/rt+6+lYFFgB6rvaH88N0RnSJd+15ki+GrFmBLwinQEDCxu0+gePQrLyU1DoiI 2gwoZOwskCnkpGHzoX4wx2uJ7cbjlBxuLhfOg0cTy1+qi8gSbDxzKbGpkCN4SK+m0YtVPUkjalJ CmO+PryRnmOm7yfH6fk0iHu+oCwryeI9/9a/yGrSC920h/FjO2ktsRjFjA== X-Received: by 2002:a05:620a:2a0e:b0:8ba:3d82:de2d with SMTP id af79cd13be357-8c6e2e46e4dmr22291585a.67.1769102817764; Thu, 22 Jan 2026 09:26:57 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <077e27345a1f5b7969c114684aede7e8@bastelstu.be> In-Reply-To: <077e27345a1f5b7969c114684aede7e8@bastelstu.be> Date: Thu, 22 Jan 2026 18:26:46 +0100 X-Gm-Features: AZwV_QjHLnWZXYsEswRyER9rVe_HxWnSGZ8hghQUForJBGSMwaW95oSwBQvxmR8 Message-ID: Subject: Re: [PHP-DEV] [RFC] Allow Reassignment of Promoted Readonly Properties in Constructor To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , Larry Garfield Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000000628560648fd59a1" From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --0000000000000628560648fd59a1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Tim, Larry, Le jeu. 22 janv. 2026 =C3=A0 17:21, Tim D=C3=BCsterhus a= =C3=A9crit : > Hi > > 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 > > Thank you. I have taken a look and have the following notes (for now): > > 1. In the Problem Statement: =E2=80=9COption 2: Use default parameter > expressions (limited):=E2=80=9D > > The example seems incorrect to me, particularly the =E2=80=9C// Cannot us= e $x in > default expression for $x=E2=80=9D comment doesn't make sense. Can you ch= eck you > pasted in the correct snippet? > > 2. Within the proposal: =E2=80=9CThe reassignment must occur directly in = the > constructor body of the declaring class (not via method calls, closures, > or other indirect means)=E2=80=9D > > I believe this is inconsistent with `__clone()` where the readonly > property remains unlocked until the end of `__clone()` (and is then > locked). > > I'm seeing it is explained further below as =E2=80=9CThis restriction exi= sts > because the check verifies that the current executing function is the > constructor of the declaring class. When a method or closure executes, > the current function changes, even if it was called from the > constructor=E2=80=9D, which effectively means that you defined the semant= ics > based on the implementation instead of the other way around, which I > consider problematic from a language design PoV. I'm positive it is > possible to find a better implementation here. > > 3. Within the =E2=80=9CRFC Impact=E2=80=9D section you removed the =E2=80= =9CEcosystem=E2=80=9D > subsection from the template. > > I believe mentioning the ecosystem impact is relevant here. This change > will likely require adjustments to static analysis tools and IDEs to not > point out the now-valid assignment as an error. > > 4. As per the updated RFC policy. > > Please already include the (closed) voting doodle in the RFC so there is > no ambiguity here. Don't forget to include the =E2=80=9CAbstain=E2=80=9D = option. My > suggested title would just be using the RFC title followed by a > questionmark :-) > > And please add a link to the list archives to the References section > (it's required per the policy and useful for future research). For your > convenience, the correct link is this: > https://news-web.php.net/php.internals/129851 > > RFC text updated to account for your comments Tim, good catch and thanks for the help around RFC processes. About the assignment rule, Larry and you have the same reaction, so let me take this as a good description of the most expected behavior by the community ;-) I made the more restricted rule because I thought I should start with the stricter rule, and I get that would also be surprising somehow, so let's relax that. PR (and RFC) updated with the new logic, similar to __clone (and as boring as it can be ;P ) Cheers, Nicolas --0000000000000628560648fd59a1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Tim, Larry,

L= e=C2=A0jeu. 22 janv. 2026 =C3=A0=C2=A017:21, Tim D=C3=BCsterhus <tim@bastelstu.be> a =C3=A9crit=C2=A0:
Hi

Am 2026-01-22 16:33, schrieb Nicolas Grekas:
> Here is a new RFC for you to consider:
> https://wiki.php.net/rfc/promote= d_readonly_constructor_reassign

Thank you. I have taken a look and have the following notes (for now):

1. In the Problem Statement: =E2=80=9COption 2: Use default parameter
expressions (limited):=E2=80=9D

The example seems incorrect to me, particularly the =E2=80=9C// Cannot use = $x in
default expression for $x=E2=80=9D comment doesn't make sense. Can you = check you
pasted in the correct snippet?

2. Within the proposal: =E2=80=9CThe reassignment must occur directly in th= e
constructor body of the declaring class (not via method calls, closures, or other indirect means)=E2=80=9D

I believe this is inconsistent with `__clone()` where the readonly
property remains unlocked until the end of `__clone()` (and is then
locked).

I'm seeing it is explained further below as =E2=80=9CThis restriction e= xists
because the check verifies that the current executing function is the
constructor of the declaring class. When a method or closure executes,
the current function changes, even if it was called from the
constructor=E2=80=9D, which effectively means that you defined the semantic= s
based on the implementation instead of the other way around, which I
consider problematic from a language design PoV. I'm positive it is possible to find a better implementation here.

3. Within the =E2=80=9CRFC Impact=E2=80=9D section you removed the =E2=80= =9CEcosystem=E2=80=9D
subsection from the template.

I believe mentioning the ecosystem impact is relevant here. This change will likely require adjustments to static analysis tools and IDEs to not point out the now-valid assignment as an error.

4. As per the updated RFC policy.

Please already include the (closed) voting doodle in the RFC so there is no ambiguity here. Don't forget to include the =E2=80=9CAbstain=E2=80= =9D option. My
suggested title would just be using the RFC title followed by a
questionmark :-)

And please add a link to the list archives to the References section
(it's required per the policy and useful for future research). For your=
convenience, the correct link is this:
https://news-web.php.net/php.internals/129851


RFC text updated to accou= nt for your comments Tim, good catch and thanks for the help around RFC pro= cesses.

About the assignment=C2=A0rule, Larry and = you have the same reaction, so let me take this as a good description of th= e most expected behavior by the community ;-)
I made the more res= tricted rule because I thought I should start with the stricter rule, and I= get that would also be surprising somehow, so let's relax that.
<= div>
PR (and RFC) updated with the new logic, similar to __cl= one (and as boring as it can be ;P )

Cheers,
=
Nicolas
--0000000000000628560648fd59a1--