2 ms·
Immutable data structures often don’t copy a lot of data around. Immutable linked lists have tail references from each head. If something falls out of scope it
by ch4s3 4y ago
Immutable data structures often don’t copy a lot of data around. Immutable linked lists have tail references from each head. If something falls out of scope it gets collected by the garbage collector. Also if you don’t share memory between processes, you can free that memory once a process terminates, which may seem orthogonal but it’s a core principle in Erlang.
- yencabulator 4y agoThose copy-on-write linked data structures, with the implied pointer chasing, have a cost. That's what the parent is talking about...
- ch4s3 4y agoA lot of languages, like Erlang/BEAM, use pointers under the hood and aren't necessarily copying anything.