Thomas Lord scripsit: > This is true as well for immutable cons pairs and immutable vectors.
Nothing I have said should give you the notion that I am opposed to those things. I do hold, however, that strings are more nearly atomic in actual use than either lists or vectors. > It is the case that a tiny implementation of small Scheme - one small > in footprint and simple in implementation - is unlikely to have much > by the way of sophisticated optimizations. Check out Chibi Scheme sometime. Naive beyond belief in some ways, intensely sophisticated in others. > Rarity is not an especially compelling argument. More important is > *importance*. The question is less "how often do I need to reach > for string mutation?" so much as the question is "how painful is it > if when I want string mutation I can't have it?". You can have it if you're willing to tolerate indirection. Especially if not having it makes the rest of your string-slinging faster and better. > Specifying only immutable strings will not save programs the kind of > expenses you are talking about. It will only give programs fewer ways > in which to deal with them. By definition, removing a feature means less flexibility. (Note well, I am *not* arguing that conformant small Schemes *remove* or *lack* string-set!.) The question is, is the flexibility worth the cost? In early Fortran, it was possible to change the value of a numeric constant by passing it by reference to a procedure. It was quickly discovered that allowing a random subset of the literal 6s in a program (perhaps all) changed to 20s was a flexibility not worth having. > An implementation that implicitly, constantly, renormalizes all strings -- > even immutable strings -- Immutable strings don't need renormalization. You normalize them when you create them, period. > Surely there will be no wise way to write code which makes such a use > of string-copy in a meaningfully portable way. Probably not. It's an implementation hack, a concession to the limitations of GCs. Java survives this problem just fine, even without special GCs. -- No, John. I want formats that are actually John Cowan useful, rather than over-featured megaliths that http://www.ccil.org/~cowan address all questions by piling on ridiculous [email protected] internal links in forms which are hideously over-complex. --Simon St. Laurent on xml-dev _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
