From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id EFD68BB83 for ; Tue, 23 May 2006 00:09:17 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4MM9Htw023279 for ; Tue, 23 May 2006 00:09:17 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA22108 for ; Tue, 23 May 2006 00:09:16 +0200 (MET DST) Received: from blizzard.cs.caltech.edu (blizzard.cs.caltech.edu [131.215.44.2]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4MM9FgJ028787 for ; Tue, 23 May 2006 00:09:16 +0200 Received: from localhost (flood.cs.caltech.edu [131.215.44.31]) by blizzard.cs.caltech.edu (Postfix) with ESMTP id A2B3B4025B1 for ; Mon, 22 May 2006 15:09:15 -0700 (PDT) Received: from blizzard.cs.caltech.edu ([131.215.44.2]) by localhost (flood.cs.caltech.edu [131.215.44.31]) (amavisd-new, port 10024) with ESMTP id 08667-09 for ; Mon, 22 May 2006 15:09:15 -0700 (PDT) Received: from [192.168.1.100] (charter-242-015.caltech.edu [131.215.242.15]) by blizzard.cs.caltech.edu (Postfix) with ESMTP id 9C41F402577 for ; Mon, 22 May 2006 15:09:14 -0700 (PDT) Message-ID: <44723689.6070204@cs.caltech.edu> Date: Mon, 22 May 2006 15:09:13 -0700 From: Aleksey Nogin Reply-To: Caml List Organization: California Institute of Technology, Computer Science Department User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Caml List Subject: Re: immutable strings II ([Caml-list] Array 4 MB size limit) References: <20060515141230.ajyupn2z28k0484s@horde.akalin.cx> <446D5E4A.8060005@akalin.cx> <20060519162844.GA32550@osiris.uid0.sk> <200605192226.34917.jon@ffconsultancy.com> <20060520212913.GB2670@first.in-berlin.de> In-Reply-To: <20060520212913.GB2670@first.in-berlin.de> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4472368D.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4472368B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bandel:01 arrays:01 mutable:01 mutable:01 compiler:01 compiler:01 20,:98 2006:98 wrote:01 wrote:01 caml-list:01 oliver:01 behaviour:01 immutable:01 immutable:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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