David Rush scripsit:
> This seems rather arbitrary, and wrong-headed (due to knock-on effects)
> in light of things like breaking mutable a-lists. Scheme is a language
> which allows free mutation of bindings and primitive objects. Immutable
> pairs is a big step on a slippery slope to a very different language.
To be fair, it only breaks mutable a-lists of which the cdr is mutated;
car mutation isn't really a problem. (I agree that mutable-car/immutable-cdr
pairs would be a Good Thing; indeed, one could view vectors as lists made
with such pairs.)
That is so delightfully daft, I'd almost vote for it. :)
Out of curiosity, would you have similar objections to immutable strings?
That is a very good question, and i don't have a very good answer just now. I think I would object in principle, but in practice i probably wouldn't notice if you didn't tell me. I think, after 10 years of programming in Scheme that i can probably count the number of times i have mutated a string - as a string - on one hand. Although, there is one highly-branched tree structure i used that probably would have run in rather less space if i'd used strings instead of vectors. So to summarize, i suspect that the incidence of mutated strings in real code is several order of magnitude lower than the use of mutable cons cells and might be vanishingly small...
david