Monotonic Collections: a middle ground between immutable and mutable(neilmadden.blog) |
Monotonic Collections: a middle ground between immutable and mutable(neilmadden.blog) |
This means in practice, users have to share (list, size) pairs - and these describe immutable sequences. So... what's the point of forcing user to keep those separately? A structure like "ImmutableListWithFastAppends" (which may be _backed_ by a mutable shared append-only list, but only as an implementation detail) seems much nicer to use - easier to understand, reason about, and is compatible with existing code.
(Author mentions "CALM principle" as a motivation for monotonic collections, but from I can see, they are simply wrong. The original Bloom paper in CIDR'11 is all about monotonic _programs_ - a very restricted programming model. Adding monotonic collections to a regular language like Java or Kotlin brings no benefits, and just makes a convoluted immutable version)