An immutable (from the external point of view of the API) Rope would essentially bring structural sharing for strings in the same way a Vector brings structural sharing to immutable lists. Instead of making a copy of the whole String, a Rope would be memory efficient in keeping different versions of a string throughout it's evolution when modifying the content. It might also be more efficient when dealing with mutations on very large strings.
Interesting, I didn't know about this data structure.
If I'm mistaken correctly, it's mainly the logarithmic insert/delete that's better than normal String, right?
We've had a similar experiment, i.e. an "immutable StringBuilder" with Vector as a base, but it didn't materialize.
@danieldietrich, what do you think, is this different enough to give it a trie (pun intended)?
@paplorinc I've thought about it the last days. I think it is an interesting data structure but it has the following disadvantages for us:
I'm still searching an argument that says we urgently need a Rope in Javaslang. But I think it will not make it into the lib.
"Making general purpose Java programming more efficient".
Make Java great again!
@nfekete I think a Rope is too special for a general purpose collection library.
For example we expose only one Tree implementation, a general purpose multi-way tree. But internally we have special trees: RedBlackTree for TreeSet/Map, HashArrayMappedTrie for HashSet/Map and BitMappedTrie for Vector.
I hope you understand if we do not implement it.
@danieldietrich sure, I was rather thinking of contributing an implementation in case I need to implement it for my own purpose. But I'm not yet sure I even need it. A simple Vector<String> might be enough to model something similar, but I haven't given it much thought yet.