Re: [RFC] Primary Constructors
| From: | Rowan Tommins [IMSoP] | Date: | Wed, 01 Jul 2026 10:43:51 +0000 |
| Subject: | Re: [RFC] Primary Constructors | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131652@lists.php.net to get a copy of this message | ||
On 1 July 2026 09:51:00 BST, Nick Sdot <php@nicksdot.dev> wrote:
>
> Just imagine you have to refactor an existing class with a primary constructor.
>
readonly would prevent what you want to do and must be removed. This
> would require you to check and refactor the whole class, instead of just adding a body. It
> doesn't make sense.
I don't understand this paragraph at all. The proposed syntax doesn't change anything
about how readonly works, as far as I know.
Any "primary constructor body" or "init block", whatever syntax it had, would
have exactly the same abilities and limitations regarding readonly properties as a normal
constructor. It would just be a different way of spelling it.
Rowan Tommins
[IMSoP]