Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I dislike the term "immutable data structure", because it has two widely used conflicting meanings:

1. Read-only data structures, which are used by everyone in every language all the time.

2. Persistent data structures, which make the underlying immutable structures kind of mutable by creating new versions and reusing parts from the old versions of the structure.



Aren't those the same things? i.e. 2. are just read-only data structures with functions to create new read-only data structures based on them. (e.g. immutable linked lists that you can filter, concat, etc. with)

Or are you talking about something more specific, like mutable data structures that provide immutable snapshots of the backing data?


lol the word "persistent" is itself ambiguous an have conflicting meaning:

1-https://en.wikipedia.org/wiki/Persistence_(computer_science)

In computer science, persistence refers to the characteristic of state of a system that outlives (persists more than) the process that created it.

2- https://en.wikipedia.org/wiki/Persistent_data_structure

In computing, a persistent data structure or not ephemeral data structure is a data structure that always preserves the previous version of itself when it is modified.


I usually distinguish "readonly" values (references which block mutation, but you can mutate via another reference) and "immutable" values (what OP calls persistent, where modification may copy-on-write but you're certain the original reference won't mutate).


Yes, first time I read about persistent data structures, I thought it had something to do with mmap :).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: