On 23/11/2024 13:11, Rob Landers wrote:
Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I would like to introduce to you a competing RFC: Data Classes (https://wiki.php.net/rfc/dataclass).


Thank you for continuing to think about this, and PoC code is always useful to work through the implications.

It seems like this is going in a very similar direction to the work Ilija shared in April: https://externals.io/message/122845 and https://github.com/php/php-src/pull/13800

My knowledge of the engine isn't good enough to compare the two PRs, but the descriptions seem very similar. The main differences seem to be details mentioned in one draft and not the other:

- You have described details for constructors and inheritance, which Ilija left as open questions - Ilija had considered how instance methods should behave, proposing a "mutating" keyword and "!" call-site marker. Your RFC doesn't discuss this - the changeName example shows behaviour *inside* the method, but not behaviour when *calling* it

Is it just an oversight that you didn't link to the previous discussion, or had you not realised how similar the proposals would end up? Either way, this looks like ripe ground for collaboration, unless there is some fundamental disagreement about the approach.


--
Rowan Tommins
[IMSoP]

Reply via email to