Version française
Home     About     Download     Resources     Contact us    
Browse thread
Array 4 MB size limit
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Aleksey Nogin <nogin@c...>
Subject: Re: immutable strings II ([Caml-list] Array 4 MB size limit)
On 20.05.2006 14:29, Oliver Bandel wrote:

> On Sat, May 20, 2006 at 11:32:15AM -0700, brogoff wrote:
> 
>>Strings are random access character collections, so under the hood they might
>>be arrays, but I think mutable strings as the default string are a mistake.
>>One can imagine other representations for strings, like ropes. I'd like a
>>language to allow many different underlying string representations.
> 
> I think it would break too much code when changing the string behaviour now.
> 
> There should be a keyword "immutable" to make strings immutable.
> Your idea would be to make it like records immutable as default
> and then the "mutable" word must be used for mutable strings.
> 
> This would also work, but then, as mentioned above, this would berak
> a lot of aleady existing code.
> 
> A compiler switch, that per default uses mutable strings,
> so as to provide backwards compatibility, but can be changed
> to immutable strings as default.
> This default string representation then could be changed with indivdual
> used keywords "mutable" and "immutable".

I would really love to have such a compiler switch (even without the 
keywords). We currently have a huge amount of code that assumes that all 
the strings are immutable. This is "sort of OK" as long as we do not 
interface with anything that would mutate strings, but, of course, I 
would love for the compiler to actually enforce this with some sort of 
"immutable strings" type.

-- 
Aleksey Nogin

Home Page: http://nogin.org/
E-Mail: nogin@cs.caltech.edu (office), aleksey@nogin.org (personal)
Office: Moore 04, tel: (626) 395-2200