William D Clinger wrote: > In short: We can develop a nice API for immutable texts, > and make it into a popular SRFI, so long as we have O(1) > string operations. If some implementations of Scheme were > to abandon O(1) string operations just so they can use an > inefficient representation, such as UTF-8 or UTF-16, then > the texts datatype might perform poorly in those systems, > but that's okay. Users who care about the performance of > immutable texts would just avoid those implementations. >
A small criticism: I think you confuse the issue when focus on immutable texts that way. Let's suppose that you have immutable texts for which string algebra (of substrings and concats) is very fast. Then, instantly, you also have mutable texts (with but one layer of indirection). I think a better way to say it might be to say that low-level string reps should be purely functional. Then you can build "stateful" things on top of that. Mutable strings are only one of the things you might build. You could build strings that have an edit history and an undo facility. And you could mix in things like character properties or region overlays. And, lot's of other weird stuff. Functional strings are definitely the low-level thing to aim for but that doesn't mean applications wind up seeing only immutable strings. It's worth, when talking about functional strings, mentioning that it really gives you not just mutable strings but a rich design space of different kinds of mutable strings. -t _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
