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.0 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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 22814BBAF for ; Mon, 6 Apr 2009 12:07:10 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnsFAJtx2UnZSMDqZGdsb2JhbACBUpRHGgsDBwcPBbIOhA8G X-IronPort-AV: E=Sophos;i="4.39,329,1235948400"; d="scan'208";a="37945757" Received: from fmmailgate03.web.de ([217.72.192.234]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Apr 2009 12:07:10 +0200 Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate03.web.de (Postfix) with ESMTP id 3FD64FA05538; Mon, 6 Apr 2009 12:07:09 +0200 (CEST) Received: from [78.43.226.218] (helo=frosties.localdomain) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #277) id 1LqljQ-0004JV-00; Mon, 06 Apr 2009 12:07:08 +0200 Received: from mrvn by frosties.localdomain with local (Exim 4.69) (envelope-from ) id 1LqljQ-0001mj-Ec; Mon, 06 Apr 2009 12:07:08 +0200 From: Goswin von Brederlow To: David Rajchenbach-Teller Cc: Zheng Li , Goswin von Brederlow , Daniel Buenzli , OCaml List Subject: Re: Strings References: <200904031256.33357.jon@ffconsultancy.com> <200904031546.14071.jon@ffconsultancy.com> <49D63EE6.2020407@ens-lyon.org> <8697F924-0485-4E00-81DF-9BCF74D872EA@erratique.ch> <87prftifa3.fsf@frosties.localdomain> <1238836234.6250.6.camel@Blefuscu> <49D8828C.40402@users.sourceforge.net> <1239009623.6058.28.camel@Blefuscu> Date: Mon, 06 Apr 2009 12:07:08 +0200 In-Reply-To: <1239009623.6058.28.camel@Blefuscu> (David Rajchenbach-Teller's message of "Mon, 06 Apr 2009 11:20:23 +0200") Message-ID: <87zleu859v.fsf@frosties.localdomain> User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.21 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX1+g53wnR5aGZZQesOTu7V9f6N2i6dN8pfdsnquo Sryqn70rkZFAEunY6tXxGJbj3QJu+D4LEuBtq2ql6r979wkp3k vis77oFJ0= X-Spam: no; 0.00; ens-lyon:01 0200,:01 abstraction:01 read-only:01 const:01 const:01 2009:98 mfg:98 wrote:01 immutable:01 immutable:01 writes:01 strings:01 strings:01 objective:02 David Rajchenbach-Teller writes: > On Sun, 2009-04-05 at 12:06 +0200, Zheng Li wrote: >> With phantom type alone, the abstraction can still leak. > > Ok, it's actually not *immutable* strings but *read-only* strings. The > objective is to be able to distribute a text and make sure that the > client won't be able to modify it. The original owner can still decide > to enter "mutable-land" if they need it. Maybe there should be another capability `Const that can only be gained when creating/copying a string. let make_const : 'a string -> [`Const; `Read] string = String.copy Those would be truely immutable. The use would be for strings passed to libraries that the library wants to ensure are immutable so it can avoid copying them. MfG Goswin