Is there any difference in a persistent and immutable data structure? Wikipedia refers to immutable data structure when discussing persistence but I have a feeling there might be a subtle difference between the two.
Is there any difference in a persistent and immutable data structure? Wikipedia refers to
Share
Immutability is an implementation technique. Among other things, it provides persistence, which is an interface. The persistence API is something like:
version update(operation o, version v)performs operationoon versionv, returning a new version. If the data structure is immutable, the new version is a new structure (that may share immutable parts of the old structure). If the data structure isn’t immutable, the returned version might just be a version number. The versionvremains a valid version, and it shouldn’t change in anyobserve-able way because of this update – the update is only visible in the returned version, not inv.data observe(query q, version v)observes a data structure at versionvwithout changing it or creating a new version.For more about these differences, see: