
On Thu, Jan 27, 2011 at 8:09 PM, Yakov Galka <ybungalobill@gmail.com> wrote:
On Thu, Jan 27, 2011 at 12:57, Dean Michael Berris <mikhailberis@gmail.com>wrote:
So more to the point, the real thing I want to focus on is the immutable string. :)
So isn't SGI's rope (without all the mutable interface) a good immutable string?
I think so... but there are some things that I think would be good to have in a string implementation that is by design immutable. There are certain things like: * Interning -- similar to what the flyweight implementation does but centers on strings and substrings * Reference counting -- as already pointed out by others earlier on * Lazy transformations -- which I'm not sure would fit entirely in the way SGI's rope is described * Simple DSEL for concatenation and layering transformations -- this would be good for efficiency reasons and would generally influence the internals of the implementation That said, the memory management and data structure of the rope internals would be a good model to follow IMO. -- Dean Michael Berris about.me/deanberris