From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 C935FBC32 for ; Tue, 15 Mar 2005 09:40:24 +0100 (CET) Received: from first.in-berlin.de (dialin-145-254-054-018.arcor-ip.net [145.254.54.18]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j2F8eNCH031095 for ; Tue, 15 Mar 2005 09:40:24 +0100 Received: by first.in-berlin.de (Postfix, from userid 501) id 74579BBB02; Tue, 15 Mar 2005 09:40:21 +0100 (CET) Date: Tue, 15 Mar 2005 09:40:21 +0100 From: Oliver Bandel To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] immutable Strings? Message-ID: <20050315084020.GP321@first.in-berlin.de> References: <20050312205011.GA2244@first.in-berlin.de> <423567E1.1030909@sophia.inria.fr> <20050314125728.GA17687@furbychan.cocan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050314125728.GA17687@furbychan.cocan.org> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 42369F77.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; oliver:01 bandel:01 oliver:01 in-berlin:01 caml-list:01 naming:01 'open:01 mutable:01 mutable:01 ocaml:01 mli:01 ...:98 ...:98 wrote:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: 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