From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id D781BBBC4 for ; Sat, 4 Apr 2009 19:11:24 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvcAAAsx10lDWxLCbmdsb2JhbACBUZRUPqZAhiOITYQPBg X-IronPort-AV: E=Sophos;i="4.39,324,1235948400"; d="scan'208";a="23949832" Received: from ip67-91-18-194.z18-91-67.customer.algx.net (HELO server1.bertec.net) ([67.91.18.194]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Apr 2009 19:11:24 +0200 Received: from [IPv6:::1] (server2.bertec.net [192.168.2.6]) by server1.bertec.net (Postfix) with ESMTP id 707651056D1 for ; Sat, 4 Apr 2009 13:11:21 -0400 (EDT) Message-Id: <3CD463A4-9B3F-4139-B300-5C6B860C1DD4@osu.edu> From: Kuba Ober To: caml-list@yquem.inria.fr In-Reply-To: <8697F924-0485-4E00-81DF-9BCF74D872EA@erratique.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: [Caml-list] Strings Date: Sat, 4 Apr 2009 13:11:20 -0400 References: <200904031256.33357.jon@ffconsultancy.com> <200904031546.14071.jon@ffconsultancy.com> <49D63EE6.2020407@ens-lyon.org> <8697F924-0485-4E00-81DF-9BCF74D872EA@erratique.ch> X-Mailer: Apple Mail (2.930.3) X-Spam: no; 0.00; bunzli:01 val:01 mutable:01 const:01 ocaml:01 mutable:01 cheers:01 wrote:01 unix:01 unix:01 caml-list:01 immutable:01 immutable:01 strings:01 strings:01 On Apr 3, 2009, at 1:50 PM, Daniel B=FCnzli wrote: > Le 3 avr. 09 =E0 18:52, Martin Jambon a =E9crit : >> - I see absolutely no practical advantage of having an immutable =20 >> "character >> string" type. > > In fact I find the result of the following sequence of operations =20 > very disappointing for a functional programming language : > > Objective Caml version 3.11.0 > > # Sys.os_type;; > - : string =3D "Unix" > # let s =3D Sys.os_type;; > val s : string =3D "Unix" > # s.[0] <- 'a';; > - : unit =3D () > # Sys.os_type;; > - : string =3D "anix" Perhaps mutable data of any type should be markable as const, with the =20= marking being permanent. Or maybe OCaml should have an immutable string wrapper that can be =20 created from a mutable string? Such immutable strings would be returned where the =20 string is not supposed to be further modified. That's where I like C++/Qt copy-on-write strings a lot. They make life =20= easy. Cheers, Kuba=