Re: [PHP-DEV] [RFC] Primary Constructors
[email protected] ("Rowan Tommins [IMSoP]")
| Newsgroups | php.internals |
|---|---|
| Message-ID | <[email protected]> |
On 29/06/2026 07:31, Nick Sdot wrote: > > If "use conventional constructors, if you need `readonly` classes" > stands, then the same can be argued for everything else in the RFC. > For the record, my view is completely the opposite: if the new syntax allows everything a normal constructor does, just in a slightly different position, it will lead to endless style discussions of which to use. In fact, I don't think even property hooks belong in a primary constructor; they're ugly enough in a constructor promoted property. I think it's perfectly fine to have short-hands that only cover specific use cases, and longer forms that let you express more complex use cases. It's one of the reasons I voted against the recent RFC to allow an extra reassignment of properties in the constructor [https://wiki.php.net/rfc/promoted_readonly_constructor_reassign]. -- Rowan Tommins [IMSoP]