[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is mutable string necessary at all?

This page is part of the web mail archives of SRFI 118 from before July 7th, 2015. The new archives for SRFI 118 contain all messages, not just those from before July 7th, 2015.



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        cowan@xxxxxxxx
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