Re: [RFC] Data Classes
| From: | Ilija Tovilo | Date: | Sat, 23 Nov 2024 22:13:58 +0000 |
| Subject: | Re: [RFC] Data Classes | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126042@lists.php.net to get a copy of this message | ||
On Sat, Nov 23, 2024 at 11:10 PM Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
>
> On Sat, Nov 23, 2024 at 2:12 PM Rob Landers <rob@bottled.codes> 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).
>
> But this is not the point I was trying to make either. Rather, when it
> comes to immutable, growable data structures, every mutation becomes
> an extremely expensive operation because the entire data structure,
> including its underlying storage, needs to be copied. For example:
>
> https://3v4l.org/BEsYT
Oops, appendImmutable() should of course have modified $new and
returned it. https://3v4l.org/IkSY1
But you get the point.