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=0.2 required=5.0 tests=AWL 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 0B632BBC4 for ; Sat, 4 Apr 2009 13:12:17 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AukDANfd1knCpx6wgWdsb2JhbACWJgEBFiK2HIQPBg X-IronPort-AV: E=Sophos;i="4.39,323,1235948400"; d="scan'208";a="23938184" Received: from smtpmin.univ-orleans.fr (HELO min.univ-orleans.fr) ([194.167.30.176]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Apr 2009 13:12:16 +0200 Received: from smtps.univ-orleans.fr (localhost [127.0.0.1]) by min.univ-orleans.fr (Postfix) with ESMTP id 348FF12B577; Sat, 4 Apr 2009 13:12:16 +0200 (CEST) Received: from [192.168.0.12] (ras75-4-82-235-58-110.fbx.proxad.net [82.235.58.110]) by smtps.univ-orleans.fr (Postfix) with ESMTP id C18A536E60; Sat, 4 Apr 2009 13:12:17 +0200 (CEST) Subject: Re: [Caml-list] Strings From: David Teller To: Jon Harrop Cc: caml-list@yquem.inria.fr In-Reply-To: <200904041111.47211.jon@ffconsultancy.com> References: <200904031256.33357.jon@ffconsultancy.com> <4b5157c30904031246x1628919ek9bed3e53b672c367@mail.gmail.com> <200904041111.47211.jon@ffconsultancy.com> Content-Type: text/plain Date: Sat, 04 Apr 2009 13:12:52 +0200 Message-Id: <1238843572.6250.49.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; univ-orleans:01 mutable:01 stringset:01 cheers:01 0100,:01 mutable:01 2009:98 wrote:01 caml-list:01 strings:01 strings:01 data:02 functional:02 string:02 bytes:03 The bad thing is that, whenever you have to return text in an otherwise functional program, you need to enter "mutable array of bytes" land. You can't just assume that the user isn't going to modify that string, because, they can, possibly by accident, and any invariant relying on the fact that your strings can't change are going to be broken. In particular, any StringSet, any StringMap, etc. Cheers, David On Sat, 2009-04-04 at 11:11 +0100, Jon Harrop wrote: > Why? This data structure is a mutable array of bytes and should be treated as > such. >