William D Clinger scripsit: > It isn't useless, and making it variable-length makes it > harder to implement, not easier, but I agree that having > variable-length strings would be useful and would add > little additional complexity to an implementation of > strings as specified in the current draft R6RS.
The question is not what's useful, but what's worth having primitively (i.e. what needs to be able to break encapsulation). Anyone can easily implement strings that are mutable in both length and content by boxing an immutable string, at a price. Historically, Scheme implementors have provided O(1) string-set!, which meant that it was well worth having content mutation, but have provided O(N) string-copy, which meant that it was not worth having length mutation -- boxing was no more and no less efficient. Common Lisp divides strings into simple and nonsimple varieties; simple-strings are like Scheme strings, whereas nonsimple strings provide both general length mutation (via ADJUST-ARRAY) and bounded length mutation (via fill pointers). This is in line with the CL principle of providing everything that seemed useful, provided the features were not too implementation-specific. Obviously it's easy to implement either feature on top of simple-strings. I conclude from this that if we are going to give up de-facto O(1) string-set!, we might as well give up string-set! altogether. The current position is untenable: we either need O(1) string-set! or immutable strings. -- John Cowan [EMAIL PROTECTED] http://ccil.org/~cowan No man is an island, entire of itself; every man is a piece of the continent, a part of the main. If a clod be washed away by the sea, Europe is the less, as well as if a promontory were, as well as if a manor of thy friends or of thine own were: any man's death diminishes me, because I am involved in mankind, and therefore never send to know for whom the bell tolls; it tolls for thee. --John Donne _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
