From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 837427F75C for ; Fri, 29 Aug 2014 18:30:55 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.04,425,1406584800"; d="scan'208";a="92105916" Received: from ec-ap-2-13-07.rocq.inria.fr (HELO [192.168.1.3]) ([128.93.40.21]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA; 29 Aug 2014 18:30:55 +0200 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1283) From: Damien Doligez In-Reply-To: <20140722.235104.405798419265248505.Christophe.Troestler@umons.ac.be> Date: Fri, 29 Aug 2014 18:30:55 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1404501528.4384.4.camel@e130> <53CD2C75.8090208@frisch.fr> <20140722.235104.405798419265248505.Christophe.Troestler@umons.ac.be> To: OCaml Mailing List X-Mailer: Apple Mail (2.1283) Subject: Re: [Caml-list] Immutable strings On 2014-07-22, at 23:51, Christophe Troestler wrote: > What about having a phantom variable on bytes indicating access? A > string could become a "ro bytes" without copying. Technically, that would work. In the latest developers meeting, we decided against the phantom type approach because its main advantage is also its main drawback: it takes advantage of the common representation of string and bytes. By keeping the two types separate, we get the freedom of representing them differently. While we have no short-term plan to do that in the normal OCaml runtime, we expect this to be a big win for the likes of ocamljava and js_of_ocaml. Also, as far as we can tell (and we need user feedback at this point) strings and byte buffers are quite distinct in normal OCaml source, so we wouldn't win much by being able to mix them. We are also open to feedback and suggestions on convenience functions that could be added to string.ml to help build strings in common cases without going through a bytes value (http://caml.inria.fr/mantis/view.php?i= d=3D6500 ) -- Damien