English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
Strings
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-04-05 (20:54)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Strings
On Fri, Apr 03, 2009 at 07:50:48PM +0200, Daniel Bünzli wrote:
> Having immutable strings would not rely on the client for correctness  
> of operation and that's always an advantage. Of course you'll tell me  
> just use String.copy inside xmlm et voilŕ, but then you traded  
> correctness for performance in a case where you could have both with  
> immutable strings.

Could you not just define a new module which is String, but with a
restricted interface (removing all the functions that can modify
strings)?  This is essentially what Batteries does, along with a bit
of camlp4 [I think] to provide a rope construction syntax.

Rich.

-- 
Richard Jones
Red Hat