Browse thread
Strings
[
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: | Goswin von Brederlow <goswin-v-b@w...> |
| Subject: | Re: [Caml-list] Strings |
David Rajchenbach-Teller <David.Teller@ens-lyon.org> writes:
> On Sat, 2009-04-04 at 19:35 -0400, Yaron Minsky wrote:
>> On Sat, Apr 4, 2009 at 5:51 PM, Goswin von Brederlow
>> <goswin-v-b@web.de> wrote:
>> Mutable/Immutable can really nicely done with phantom types
>> and is
>> independent of the data structure used. It works for strings,
>> lists,
>> arrays, sets, trees, ... and I think all standard modules
>> should have
>> it. The official standard lib is rather lacking there but that
>> is why
>> there is Batteries. The more I hear/see of it the more I like
>> it.
>>
>> On this note, there's a small variation on this idea that we've
>> experimented with at Jane Street that I think is worth mentioning.
>> When people do this kind of thing, they usually have two phantom tags,
>> "immutable" and "mutable", but, there is another natural one to add:
>> "readonly".
>
> Actually, thats exactly what we have for strings and arrays in
> Batteries.
>
> Cheers,
> David
Where do you have an immutable string? One where you are sure that
nobody can hold a [> `Write] reference to the string. I only saw the
read and write phantom flags.
MfG
Goswin