Version française
Home     About     Download     Resources     Contact us    
Browse thread
immutable Strings?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] immutable Strings?
On Mon, Mar 14, 2005 at 12:57:29PM +0000, Richard Jones wrote:
> On Mon, Mar 14, 2005 at 11:30:57AM +0100, Pascal Zimmer wrote:
> > - you cannot use the shortcuts s.[i] and (^) anymore (this gets the code 
> > less readable especially for the first one)
> 
> You can get the s.[i] shortcut by naming your module
> 'ImmString.String' (using a nested module in other words) and using
> 'open ImmString'.  However this has the further problem that you then
> can no longer use mutable strings :-( although perhaps Oliver has
> forsworn use of mutable strings, so this is an acceptable compromise
> for him.

forsworn mutable strings? ???

Mutable strings are ok for many tasks, but sometimes
immutable strings are better.

It's the same like wondering which style of programming is better for a task.
So, OCaml seems to be very open to different programming styles...
...why not to different kinds of strings?


At the time I have done it with String.copy and modyfing the copy.
But as soon as I has some time to look at the suggestions made here,
I may use them in a reimplementation of my module.
Thanks to *.mli this will not affect the user of the module. :)

Ciao,
   Oliver