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: | 2009-04-06 (10:07) |
From: | Goswin von Brederlow <goswin-v-b@w...> |
Subject: | Re: Strings |
David Rajchenbach-Teller <David.Teller@ens-lyon.org> writes: > On Sun, 2009-04-05 at 12:06 +0200, Zheng Li wrote: >> With phantom type alone, the abstraction can still leak. > > Ok, it's actually not *immutable* strings but *read-only* strings. The > objective is to be able to distribute a text and make sure that the > client won't be able to modify it. The original owner can still decide > to enter "mutable-land" if they need it. Maybe there should be another capability `Const that can only be gained when creating/copying a string. let make_const : 'a string -> [`Const; `Read] string = String.copy Those would be truely immutable. The use would be for strings passed to libraries that the library wants to ensure are immutable so it can avoid copying them. MfG Goswin