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 35908BB84 for ; Sat, 20 May 2006 23:29:19 +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 k4KLTIpM025363 for ; Sat, 20 May 2006 23:29:18 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA13965 for ; Sat, 20 May 2006 23:29:17 +0200 (MET DST) Received: from einhorn.in-berlin.de (einhorn.in-berlin.de [192.109.42.8]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4KLTGrZ025354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 20 May 2006 23:29:17 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from first.in-berlin.de (e178011229.adsl.alicedsl.de [85.178.11.229]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id k4KLTDt4016330 for ; Sat, 20 May 2006 23:29:13 +0200 Received: by first.in-berlin.de (Postfix, from userid 501) id 2DE6528815E; Sat, 20 May 2006 23:29:13 +0200 (CEST) Date: Sat, 20 May 2006 23:29:13 +0200 From: Oliver Bandel To: caml-list@inria.fr Subject: Re: immutable strings II ([Caml-list] Array 4 MB size limit) Message-ID: <20060520212913.GB2670@first.in-berlin.de> References: <20060515141230.ajyupn2z28k0484s@horde.akalin.cx> <446D5E4A.8060005@akalin.cx> <20060519162844.GA32550@osiris.uid0.sk> <200605192226.34917.jon@ffconsultancy.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at concorde with ID 446F8A2E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 446F8A2C.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 ocaml's:01 arrays:01 arrays:01 mutable:01 mutable:01 compiler:01 compiler:01 overwrite:01 20,:98 2006:98 wrote:01 wrote:01 caml-list: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.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Sat, May 20, 2006 at 11:32:15AM -0700, brogoff wrote: > On Fri, 19 May 2006, Brian Hurt wrote: > > On Fri, 19 May 2006, Jon Harrop wrote: > > > > > Agreed. Should OCaml's successor have extensible arrays with 64-bit lengths > > > and strings as char arrays? > > 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 don't know how much development effort this would be, but it would be a fine thing. ============++=====================++=======================++ \ default || mutable strings || immutable strings || \-------+ || as default || as default || keyword \ || (compiler switch) || (compiler switch) || ===========+++=====================++=======================++ ./. || all strings are || all strings are || || mutable || immutable || ============++=====================++=======================++ mutable || all strings are || all strings that || || mutable || are not declared as || || || mutable are immutable || ============++=====================++=======================++ immutable || all strings that || all strings are || || are not declared as || immutable || || immutable are || || || mutable || || ============++=====================++=======================++ In short words: The compiler flag would give the default string representation in use, and the keywords "mutable" and "immutable" used for individual strings would overwrite that default individally. And as default for the compiler - for backward compatibility reasons - would then be used the mutable string representation. Ciao, Oliver