Browse thread
RE: [Caml-list] Re: immutable strings (Re: Array 4 MB size limit)
-
Harrison, John R
- moj@u...
- Martin Jambon
- Jean-Christophe Filliatre
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jean-Christophe Filliatre <filliatr@l...> |
| Subject: | RE: [Caml-list] Re: immutable strings (Re: Array 4 MB size limit) |
Harrison, John R writes: > The point is not that I will mutate a string by accident. I once discovered a bug in the Coq proof assistant that was precisely due to a string (an identifier) mutated by accident (may be I shouldn't say it :-) A name was capitalized in-place somewhere in a piece of code unrelated with the Coq kernel but of course it had consequences all over the system (including the kernel). So I'm definitely in favor of immutable strings, for the exact reasons mentioned by John. But I think an abstract data type is not really an issue, since one does little pattern-matching on strings in practice. And having your own abstract data type for immutable strings has other advantages, such as the ability to share equal strings (using hash-consing) to speedup names comparisons. Even printing is not painful provided a suitable formatter-based printing function and %a. -- Jean-Christophe Filliātre (http://www.lri.fr/~filliatr)