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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id EFFA97FA01 for ; Sat, 5 Jul 2014 13:04:25 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.187; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.187; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.187; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AigBALrat1PU4367lGdsb2JhbABag2CvFJAxhz8BgQYWDwEBAQEHCwsJEiqEAwEBBAFVGQsFCwsYDSFFEgYTCQkJiBMDCQwJw1UDhlwXiUmDO4F4JgeCNg9EgToFhGkFi3OIGINFhUIFkEJq X-IPAS-Result: AigBALrat1PU4367lGdsb2JhbABag2CvFJAxhz8BgQYWDwEBAQEHCwsJEiqEAwEBBAFVGQsFCwsYDSFFEgYTCQkJiBMDCQwJw1UDhlwXiUmDO4F4JgeCNg9EgToFhGkFi3OIGINFhUIFkEJq X-IronPort-AV: E=Sophos;i="5.01,607,1400018400"; d="asc'?scan'208";a="70239983" Received: from mout.kundenserver.de ([212.227.126.187]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Jul 2014 13:04:25 +0200 Received: from office1.lan.sumadev.de (dslb-188-107-170-128.pools.arcor-ip.net [188.107.170.128]) by mrelayeu.kundenserver.de (node=mreue006) with ESMTP (Nemesis) id 0MSlXs-1XB3HQ0Wn6-00RVr1; Sat, 05 Jul 2014 13:04:24 +0200 Received: from [192.168.0.146] (546BEFE6.cm-12-4d.dynamic.ziggo.nl [84.107.239.230]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 7A13DDC270; Sat, 5 Jul 2014 13:04:23 +0200 (CEST) Message-ID: <1404558258.4384.16.camel@e130> From: Gerd Stolpmann To: Anthony Tavener Cc: caml-list Date: Sat, 05 Jul 2014 13:04:18 +0200 In-Reply-To: References: <1404501528.4384.4.camel@e130> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-cXe5ehpGPqMFt6idE/C8" X-Mailer: Evolution 3.10.4-0ubuntu1 Mime-Version: 1.0 X-Provags-ID: V02:K0:a5nEhyPJUZGdrfcY6rmT55LhkIjM1kMnjMsQUVior7s YLdvbSu8C+KBXNp+PcdUoiByaOOBiZWbsrwV4kB+iZszNDExQV zT+UI4uSr9FqqbRcs0tuPVw13FYbQtYJZbPC/MGoH+LaX+Zwe1 RRbi28PCdA07Ra4Tj/ofJM0rgGtBHMRPTwyTCdcxNqwzTLj1HT lzODyXYdU1HwVktLdZysgd+g3s79745RaZppSs5JJ6V2OJA0hx lilxl1sTy60UL8wXKE2M3+8xCk4eFcqwiYAUYjpkefi/RLy4CA oLTenkwBHHGb011x9PyEneOcKpIgNCf6Hdem/KtIkg6Urh6qIW S9kLRn7vWKt/iCbpljGe86LLhlk3PXxLrBxNLGUqr Subject: Re: [Caml-list] Immutable strings --=-cXe5ehpGPqMFt6idE/C8 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Freitag, den 04.07.2014, 14:31 -0600 schrieb Anthony Tavener: > It seems the "bytes" type would be most useful in cases where mutable > and > immutable strings are used in a mixed manner... but given these > practical > issues you raise, it could be less pleasant than it first appears. > Your > "stringlike" solution seems reasonable, but I don't have a good > use-case in > mind for mixed mutable/immutable to help me imagine the result. What > are some > scenarios where this mix of types is desired? I think even Rust > doesn't > support mutable strings -- which seems bold for its target audience, > yet > they're fine with it? I've mostly buffers in mind, as you need them for block-by-block I/O. Actually, I started thinking about this issue when looking again at OCamlnet, and how I could use "bytes" there. It's a hard case, lots of buffers of different types, and you really run into the problems I sketched in the article, as it is a common operation to copy the contents of one buffer into the other. That's also why I'm suggesting to use bigarrays - for interfacing with C these are much easier to use as buffers, as bigarrays are just malloc'ed memory and cannot be moved around by the GC. (And the C interface is needed for I/O.) So my scenario is quite low-level: I/O, and C interfaces. > When I consider possible scenarios of utf8 encoded strings, No, that's a no-go, of course. When it comes to real text, mutability doesn't give you much. Gerd > and mutating that > in-place... ugh. Even "back in the day", doing string operations in C > on > ASCII, I'd favor building a new string rather than flirting with > saving ops by > overwriting values in the current string. Oh! Upper/lower-case! Maybe > that's > the one good use-case. ;) >=20 >=20 >=20 >=20 > On Fri, Jul 4, 2014 at 1:18 PM, Gerd Stolpmann > wrote: > Hi list, >=20=20=20=20=20=20=20=20=20 > I've just posted a blog article where I criticize the new > concept of > immutable strings that will be available in OCaml 4.02 (as > option): >=20=20=20=20=20=20=20=20=20 > http://blog.camlcity.org/blog/bytes1.html >=20=20=20=20=20=20=20=20=20 > In short my point is that it the new concept is not far > reaching enough, > and will even have negative impact on the code quality when it > is not > improved. I also present three ideas how to improve it. >=20=20=20=20=20=20=20=20=20 > Gerd > -- > ------------------------------------------------------------ > Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de > My OCaml site: http://www.camlcity.org > Contact details: http://www.camlcity.org/contact.html > Company homepage: http://www.gerd-stolpmann.de > ------------------------------------------------------------ >=20=20=20=20=20=20=20=20=20 >=20=20=20=20=20=20=20=20=20 >=20=20=20=20=20=20=20=20=20 > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20 >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-cXe5ehpGPqMFt6idE/C8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJTt9uyAAoJEAaM4b9ZLB5T6WMH/idmyDApHpd3TuUYwd0Q4vip vqx+QybctP+Hi6UWGs/3ElswZBp17JhDBqskdZXF1I66fHXKGLlttlyMMoa9lDfH 7Y4TbbpFPcclRQEtb2WFJRvDgasJWlN9kMFC7ir/bRz0o8ie52sdmYLBQ2Y6HL3B pJonYr3bx0tA0EJ12CIDDdPXnDjkPvPXL+TgNck2+CTI44EoEnGIk/eUKnaop8g1 Zkaoh2PMAl5oeXxvuk6J//sF5sfp1YuVQ982/T7jALDfSngP1//bSMf9Q0gDNuPC 3I0gW3Nnno8MTqr6Sess6ggH7zTHs3sAbo4VH39ksgPelp+Bvft5q4PZ4TXpaS8= =MafQ -----END PGP SIGNATURE----- --=-cXe5ehpGPqMFt6idE/C8--