Is mutable string necessary at all? Shiro Kawai (02 Jan 2015 20:17 UTC)
Re: Is mutable string necessary at all? John Cowan (02 Jan 2015 23:52 UTC)

Re: Is mutable string necessary at all? John Cowan 02 Jan 2015 23:52 UTC

Shiro Kawai scripsit:

> There can be other choices, but I suggest that a portable code
> shouldn't count on that mutating operations is any more efficient
> than immutable solutions.

True.  Indeed, in plain Chicken, mutation is cheap but change of size
would be very expensive, since there is no indirection.  Chicken with
the UTF-8 egg in fact requires garbage collection when mutation involves
increasing the length in bytes, as a new object has to be allocated and
then all existing pointers must be fixed up.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
The competent programmer is fully aware of the strictly limited size of his own
skull; therefore he approaches the programming task in full humility, and among
other things he avoids clever tricks like the plague.  --Edsger Dijkstra