On Sat, Nov 23, 2024 at 11:10 PM Ilija Tovilo <tovilo.il...@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.